在生产模式下配置symfony2以在收到异常后发送电子邮件

问题描述 投票:2回答:1

我正在使用symfony2开发一个项目,我将其上传到网络上,然后将其从开发模式转换为生产模式,进行了一些测试,当出现异常时,它向我的收件箱发送了3O电子邮件,有我的config_prod代码: 注意:我正在使用monolog进行日志记录

 imports:
    - { resource: config.yml }

   #framework:
   #    validation:
   #        cache: apc

doctrine:
    orm:
        metadata_cache_driver: apc
        result_cache_driver: apc
        query_cache_driver: apc

monolog:
    handlers:
        main:
            type:         fingers_crossed
            action_level: error
            handler:      grouped
        grouped:
            type:       group
            members:    [streamed, swift]
        streamed:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug
        swift:
            type:           swift_mailer
            from_email:     [email protected]
            to_email:       [email protected]
            subject:        "GESTIBAT::Error_Exception"
            level:          debug
        login:
            type:           stream
            path:           "%kernel.logs_dir%/auth.log"
            level:          info
            channels:       security

如果有人有想法,谢谢您的帮助!

symfony swiftmailer monolog
1个回答
0
投票

symfony2文档中所述,您应该在发送日志消息之前对其进行缓冲

buffered:
  type:    buffer
  handler: swift
© www.soinside.com 2019 - 2024. All rights reserved.