在我的 Symfony 3.4 中。应用程序我已经配置了一个自定义记录器:
monolog:
handlers:
my_channel:
level: debug
type: stream
path: '%kernel.logs_dir%/my_channel.log'
max_files: 10
channels: [my_channel]
当我在我的代码中使用这个记录器时,我已经正确注入了通道“my_channel”。
$this->logger->error('error message', $data = ['my context here']);
在屏幕上,我得到正确显示的 $data 信息:
09:00:08 ERROR [my_channel] error message ["my context here"]
但不在我的日志中,上下文为空:
09:00:08 ERROR [my_channel] error message []
问题:如何将上下文也记录到我的日志文件中?