In my commands, I want loggers to log into the file console.log
Here is my monolog.yaml conf:
when@prod:
monolog:
handlers:
console:
type: stream
level: debug
path: "%kernel.logs_dir%/console.log"
channels: console
console-error:
type: stream
level: error
path: "%kernel.logs_dir%/console-error.log"
channels: console
info:
type: stream
path: "%kernel.logs_dir%/info.log"
level: info
In my command I've added this: #[WithMonologChannel('console')]
Every log in my command are correctly logged to console.log but every time I call a function outside my command class, the log is logged in info.log.
The issue is that I don't want to add #[WithMonologChannel('console')] in my other class since it's used by other services.
Is there any way to propagate the channel along called functions ?
In my commands, I want loggers to log into the file
console.logHere is my
monolog.yamlconf:In my command I've added this:
#[WithMonologChannel('console')]Every log in my command are correctly logged to
console.logbut every time I call a function outside my command class, the log is logged ininfo.log.The issue is that I don't want to add
#[WithMonologChannel('console')]in my other class since it's used by other services.Is there any way to propagate the channel along called functions ?