monolog-cascade
monolog-cascade copied to clipboard
Getting the streamhandler URL(s)
this link adds a getter for the streamhandler url.
I am having issues figuring out, after my $log = Cascade::getLogger('config');
, how to access the name of the file I am logging to, as a result of my (snippet) config:
'info_file_handler' => array(
'class' => 'Monolog\Handler\StreamHandler',
'level' => 'INFO',
'formatter' => 'full',
'stream' => $logfile
//'stream' => '/tmp/htmApp.log'
),
'error_file_handler' => array(
'class' => 'Monolog\Handler\StreamHandler',
'level' => 'ERROR',
'stream' => $errlogfile,
'formatter' => 'spaced'
)
Logging is working. When I dump the object I see the URL. How do I get it after making my logger object?
Not sure I understand...
The path to your log file is in your $logfile
variable. If it holds /tmp/htmApp.log
then Monolog will log to this file.
Yes I know that. What I am asking is more basic - I need to use the URL in further php processing, long after instantiating when only the logging object is available, not the variable $logfile. How do I get it?
In standard object programming if I had something like protected $attribute;
in the class I would do code something like $myval = $object->getAttribute();
which would give me the value of, say, $this->attribute;
from $object.