我想设置 Symfony2 向我发送一封critical
错误电子邮件,但只是日志error
级别的错误。以下设置会这样做吗?
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: grouped
grouped:
type: group
members: [filelog, mail]
# log all errors to file
filelog:
type: fingers_crossed
action_level: error
handler: nested_stream
nested_stream:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
# send me an email when we have a critical error
mail:
type: fingers_crossed
action_level: critical
handler: buffered
buffered:
type: buffer
handler: swift
swift:
type: swift_mailer
from_email: %mailer_sender%
to_email: %error_email%
subject: "[FeedStream Error]"
level: debug
我看到了:http ://symfony.com/doc/current/cookbook/logging/monolog_email.html但它根本无法处理error
,这是我仍然想要日志(但没有电子邮件)的情况。我很确定我的配置会起作用,但我对独白设置知之甚少。请让我知道这是否正确或是否有更好的方法。