是否可以格式化syslog的日志? config.yml配置系统日志:
monolog:
channels: ['auth']
handlers:
auth:
type: syslog
level: debug
facility: local0
channels: [auth]
在出现警告的情况下打印出的结果行:
Sep 20 15:43:31 api2 [10227]: auth.WARNING: invalid password {"method":"ApiBundle\\Api.....
我想看的那一行:
Sep 20 15:43:31 api2 auth.WARNING[10227]: invalid password {"method":"ApiBundle\\Api.....
我尝试使用没有运气的格式化程序:
# config.yml
monolog:
...
handlers:
auth:
...
formatter: monolog.formatter.auth_exception
# services.yml
monolog.formatter.auth_exception:
class: Monolog\Formatter\LineFormatter
arguments:
- "[%%datetime%%] %%channel%%.%%level_name%%: %%message%% %%context%% %%extra%%\n"