S
S
Steve2021-05-31 16:41:24
symfony
Steve, 2021-05-31 16:41:24

How to send error mail via monolog?

I do off. doc.
For me it looks like this:

# config/packages/prod/monolog.yaml
monolog:
   handlers:
       main:
           type: fingers_crossed
           # 500 errors are logged at the critical level
           action_level: critical
           # to also log 400 level errors (but not 404's):
           # action_level: error
           # excluded_404s:
           #     - ^/
           handler: deduplicated
       deduplicated:
           type: deduplication
           handler: swift
       swift:
           type: swift_mailer
           from_email: '[email protected]'
           to_email: '[email protected]'
           # or list of recipients
           # to_email:   ['[email protected]', '[email protected]', ...]
           subject: 'An Error Occurred! %%message%%'
           level: debug
           formatter: monolog.formatter.html
           content_type: text/html
       file_log:
           type: stream
           path: "%kernel.logs_dir%/%kernel.environment%.log"
           level: debug

       syslog_handler:
           type: syslog
           level: error

And
# config/packages/swiftmailer.yaml

swiftmailer:
    transport:            smtp
    username:             my_username
    password:             my_password
    host:                 email-smtp.eu-west-1.amazonaws.com
    port:                 587
    auth_mode:            login
    encryption:           tls
    local_domain:         my_domain
    spool:                { type: 'memory' }
    stream_options:
        ssl:
            verify_peer: false
            verify_peer_name: false

You can, please, explain how to send letters about errors. In a word, make it work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Derepko, 2021-05-31
@uDenX

level:debug

https://github.com/Seldaek/monolog/blob/main/doc/0...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question