Closed
Description
Suggested updates to http://symfony.com/doc/2.8/cookbook/logging/monolog_email.html according to the last release of monolog https://github.com/Seldaek/monolog/releases/tag/1.19.0, and overall best practices (IMO).
# app/config/config_prod.yml
monolog:
handlers:
mail:
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: 'error@example.com'
to_email: 'error@example.com'
# or list of recipients
# to_email: ['dev1@example.com', 'dev2@example.com', ...]
subject: 'An Error Occurred! %%message%%'
level: debug
formatter: monolog.formatter.html
content_type: text/html
Namely this switches to the new deduplication handler, adds the message to the email subject, and formats the emails nicely with the html formatter (which is very valuable IMO for readability, and adds full stack traces and so on).