我将Symfony 2.4与monolog一起使用并具有monolog配置:
monolog:
channels: ["voter", "worker"]
handlers:
# 'critical' means HTTP 5XX responses.
critical:
type: fingers_crossed
action_level: critical
handler: critical_group
# 'error' means HTTP 4XX responses.
error:
type: fingers_crossed
action_level: error
handler: error_stream
debug:
type: fingers_crossed
action_level: debug
handler: debug_stream
critical_group:
type: group
members: critical_stream
critical_stream:
type: stream
path: %kernel.logs_dir%/%kernel.environment%_critical.log
level: critical
error_stream:
type: stream
path: %kernel.logs_dir%/%kernel.environment%_error.log
level: error
debug_stream:
type: stream
path: %kernel.logs_dir%/%kernel.environment%_warning.log
level: debug
我想从调试消息中排除警告消息。并从错误消息中警告和调试消息以获取更干净的日志。对此有什么解决方案吗?
感谢您的任何建议!
答案 0 :(得分:4)
您可以使用filter
处理程序。
这是一个基于你的配置的附加处理程序:
handlers:
cleaned_debug:
type: filter
handler: debug
accepted_levels: [DEBUG]