我在 Symfony 4 上,我想为许多日志类型创建一个专用通道:这是我对通道和处理程序的配置:
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"]
然后,在我写日志的服务中,我注入自定义
services:
_defaults:
autowire: true
autoconfigure: true
Infrastructure\Logger\Channel1Logger:
arguments:
- '@monolog.logger.channel1'
Infrastructure\Logger\Channel2Logger:
arguments:
- '@monolog.logger.channel2'
但是,我所有的日志都直接写入通道“应用程序”,当我调试容器时,我看到我的服务列出了我做错了什么?
萧十郎