【问题标题】:Monolog not logging context独白不记录上下文
【发布时间】:2018-05-15 08:33:44
【问题描述】:

在我的 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 []

问题:如何将上下文也记录到我的日志文件中?

【问题讨论】:

    标签: symfony logging monolog symfony3.x


    【解决方案1】:

    原因是上下文数据不是 UTF-8 编码的。

    【讨论】:

      猜你喜欢
      • 2015-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-06
      • 1970-01-01
      • 2010-11-03
      • 2015-11-11
      • 1970-01-01
      相关资源
      最近更新 更多