monolog-cascade icon indicating copy to clipboard operation
monolog-cascade copied to clipboard

Getting the streamhandler URL(s)

Open bsussman opened this issue 6 years ago • 2 comments

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?

bsussman avatar May 03 '18 22:05 bsussman

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.

rantonmattei avatar May 15 '18 15:05 rantonmattei

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.

bsussman avatar May 15 '18 18:05 bsussman