Closed ro0NL closed 4 years ago
IMO this is rather a bug of the MonologBundle. If the class is already configured with a processor tag, it should not add another tag due to the class implementing that interface. Should be reported/fixed there.
Also having getChannels would not help as you want the configuration to define where the processor is used, not the processor itself.. Otherwise it becomes very tightly coupled.
Hi!
Today we spent severe time debugging a processor :)
Intuitively we implement
ProcessorInterface
for its contract value, and being a core library type.Turns out the Symfony bundle auto configures these as such, tagging them with
monolog.processor
This effectively breaks https://symfony.com/doc/current/logging/processors.html#registering-processors-per-channel as it's tagged twice, thus the auto configured one has no channel causing it to be pushed to all loggers, instead of a channel specific one.
Perhaps we should have read
https://github.com/Seldaek/monolog/blob/f2d431523774cb675409669f0eec1e6cf127cc5c/src/Monolog/Processor/ProcessorInterface.php#L15
AFAIK the general purpose is type based autoconfiguration for DI, but maybe it's worth to create an additional
ChannelAwareProcessorInterface
for the same general purpose.Or add it to ProcessorInterface directly even :/
Thoughts?