Closed ash-m closed 1 year ago
The correct way to use it is (apparently) just specifying the class without tags
as far as I remember, the tag monolog.processor
is required (so that it is properly registered),
but the channel not, and not defining channel will attach this processor to all monolog channels
You have requested a non-existent service "monolog.logger.main". (500 Internal Server Error)
do you have a monolog channel named main
in your config?
Correct. You are in "Registering Processors per Channel" section, so this works only if you have logger with same channel. Nothing wrong with docs there IMO. Error message could be improved, but that improvement would go to https://github.com/symfony/monolog-bundle
Well, if you haven't created a main
channel, this error is expected if you try to register your processor for the main
channel only.
Note that the default channel of monolog-bundle is named app
and if you omit the channel in the tag, it gets registered for all channels.
Thank you all for your review. We're trying to improve this in #18901.
How to Add extra Data to Log Messages via a Processor claims:
Given the instructions for how to implement a custom processor in
services.yaml
immediately preceding that text (which I would consider "registering"), I would expect the built-ins to be registered something like:But this will result in an error:
The correct way to use it is (apparently) just specifying the class without
tags
, though I don't really understand why that is the case or how built-in processors like that should be configured (eg: which channel?)The same goes for monolog built-ins which the article links to:
Though that may just be indicating that Symfony has used some of the monolog built-ins for it's bridge and you can use them for reference rather than how to actually implement individual monolog built-ins. Still some clarification on that would help.