Seb*_*eck 1 logging symfony monolog symfony3.x
在我的 Symfony 3.4 中。应用程序我配置了一个自定义记录器:
monolog:
handlers:
my_channel:
level: debug
type: stream
path: '%kernel.logs_dir%/my_channel.log'
max_files: 10
channels: [my_channel]
Run Code Online (Sandbox Code Playgroud)
当我在代码中使用此记录器时,我已使用通道“my_channel”正确注入了该记录器。
$this->logger->error('error message', $data = ['my context here']);
Run Code Online (Sandbox Code Playgroud)
在屏幕上我正确显示了 $data 信息:
09:00:08 ERROR [my_channel] error message ["my context here"]
Run Code Online (Sandbox Code Playgroud)
但在我的日志中,上下文不是空的:
09:00:08 ERROR [my_channel] error message []
Run Code Online (Sandbox Code Playgroud)
问题:如何将上下文也记录到我的日志文件中?
归档时间: |
|
查看次数: |
1555 次 |
最近记录: |