I'm on Symfony 4 and I want to create a dedicated channel for many log types: this is my configuration for channels and handlers:
monolog:
channels: ["channel1", "channel2"]
handlers:
channel1:
level: debug
type: stream
path: "%kernel.logs_dir%/channel1.log"
channels: ["channel"]
channel2:
level: debug
type: stream
path: "%kernel.logs_dir%/channel2.log"
channels: ["channel2"]
Then, in my service to write log, I inject the custom
services:
_defaults:
autowire: true
autoconfigure: true
Infrastructure\Logger\Channel1Logger:
arguments:
- '@monolog.logger.channel1'
Infrastructure\Logger\Channel2Logger:
arguments:
- '@monolog.logger.channel2'
But, all my logs are directly written to the channel "app", When I debug the container, I see my services listed What I'm doing wrong?