Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting the streamhandler URL(s) #83

Open
bsussman opened this issue May 3, 2018 · 2 comments
Open

Getting the streamhandler URL(s) #83

bsussman opened this issue May 3, 2018 · 2 comments

Comments

@bsussman
Copy link

bsussman commented May 3, 2018

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?

@rantonmattei
Copy link
Contributor

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.

@bsussman
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants