I work on two different projects based on symfony2.x and symfony 3.x. I want to setup both projects to send me an email for critical errors, but just log error-level errors.
The following setting works on symfony 2.8 but not on symfony3.
monolog:
handlers:
main_critical:
type: fingers_crossed
action_level: error
excluded_404:
- ^/
handler: grouped_critical
grouped_critical:
type: group
members: [streamed_critical, buffered_critical]
streamed_critical:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%_critical.log"
level: critical
buffered_critical:
type: buffer
handler: swift_critical
swift_critical:
type: swift_mailer
from_email: "%error_mail_sender%"
to_email: "%critical_error_mail_recipients%"
subject: Critical error occurred!
level: critical
main_error:
type: fingers_crossed
action_level: error
handler: grouped_error
grouped_error:
type: group
members: [streamed_error]
streamed_error:
type: stream
path: "%log_file_path%"
level: error
The error is :
Fatal error: Uncaught Error: Maximum function nesting level of '256' reached, aborting! in /var/www/statistic/vendor/symfony/symfony/src/Symfony/Component/Debug/Exception/FatalErrorException.php on line 7
I am not sure what's wrong with this setting as it works for symfony 2.8 but not 3.x.
But when I remove this following block, then it works on symfony 3 project. But it will log only critical errors via email without following settings.
main_error:
type: fingers_crossed
action_level: error
handler: grouped_error
grouped_error:
type: group
members: [streamed_error]
streamed_error:
type: stream
path: "%log_file_path%"
level: error
Any idea?