Answer the question
In order to leave comments, you need to log in
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
# 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
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question