-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Cannot Inject Custom Handler to Magento\Framework\Logger\Monolog #2234
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
Comments
@alankent can you look at this one? you did some research on it earlier |
Adding an additional handler to the list is likely not working currently due to an issue in how the \Monolog\Logger is getting the list of handlers from the ObjectManager. see #2529 For custom logging you could define your own custom logger with a custom handler. You could specify the custom handler to write to a separate file, and anywhere you inject and use your custom logger it would write to the log file you specify in your custom handler. I haven't seen any way of accomplishing this outside of writing your own custom logger and handler. |
I've discovered an issue and in my opinion we have to follow next points:
Internal ticket |
FYI: The Monolog library was updated to support associative arrays in the Monolog 1.18.0 release. Currently it looks like Magento is requiring Monolog 1.16.0. Also be aware that if you hand Monolog 1.16.0 a list of handlers as an indexed array then the behavior of logging that we currently see could change as I pointed out in #2529 and duplicate the logging of some messages to both the debug and system handlers because of the default behavior of the handler to allowing messages to "bubble" and be passed to the next handler in the list. |
Hi @jksimoniii issue was fixed and delivered |
I am trying to have my module write log messages to it's own file. I found the following argument injection in app/etc/di.xml. I am trying to inject my own handler in the same fashion, but it does not appear when the constructor fires.
I noticed that _Monolog_ is instantiated after the primary scope of DI is merged, but before the global scope gets merged.
If this is not the route to achieve custom log files, what would be the correct approach?
The text was updated successfully, but these errors were encountered: