mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #131] Different actions for different error levels #45
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lopsided on GitHub (Nov 30, 2012).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/131
Hi,
Im not sure this really qualifies as an issue but my SO post got no replies so not sure where else to turn (http://stackoverflow.com/questions/13478573/symfony2-monolog-different-actions-for-different-error-levels).
I have set up Monolog for our Symfony2 project to email out critical errors to us when they occur.
However I would also like to log non-critical errors also, and to email these errors out to different recipients. I am struggling to see this in the documentation however it looks like it should be possible. I have set up the config as follows:
With this set up we receive the critical errors but don't get the non-critical errors.
This set up was loosely based on the (unaccepted) answer to this question: http://stackoverflow.com/questions/12481353/how-to-include-the-severity-of-a-log-in-the-e-mail-subject.
Can anyone spot what is wrong with this? Or if it is not possible to do what I am trying?
Thanks a lot!
@Seldaek commented on GitHub (Nov 30, 2012):
The problem seems to be bubble: false in the first handler, that means it'll stop propagating messages to other handlers.
Another note, I would remove the group and the streamed handler from grouped_critical, because it will already receive errors from grouped_error, resulting in duplicate entries in the log file.
So this should work:
I reordered them to make it easier to see the two handler chains as well.
@lopsided commented on GitHub (Nov 30, 2012):
Thanks a lot for the reply! It is almost there now, however the only thing is that Critical errors are firing 2 emails, one from each handler. That's why I thought to add the
bubble: falsepreviously. I tried adding it back in but it doesn't seem to workIs it possible to remove the second email for critical errors?
@Seldaek commented on GitHub (Nov 30, 2012):
You can only filter down and not up, so you can't split the levels into =CRITICAL. That said, the problem seems to be that critical_error_mail_recipients contains the siteerrors@mysite.com, but that one doesn't need to be there, since they'll already get a mail in case of simple errors. Just removing this should make sure everyone gets at most one mail.
@lopsided commented on GitHub (Nov 30, 2012):
Right yeah I thought that might be the case.
Thanks a lot for your help and explanations :)