-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log errors with level error #140
base: master
Are you sure you want to change the base?
Conversation
I think we may need some more fine-grained handling here, and need to consider all the cases. Being too 'loud' is just as much an issue as being too 'quiet', and I normally go by the rule that you shouldn't do 'warning' or 'error' unless there is a correct and sufficiently fine-grained way to silence those things. Otherwise, the true signal of things you need to attend to gets lost in the noise of things you don't. Normally But here, one of the errors caught is We need to know exactly when the different errors occur, and log at appropriate levels. |
I get what you are saying, I was just going by other use of django-mailer/src/mailer/engine.py Lines 149 to 167 in ae0475c
I think that is fine. If the lock cannot be cleared for an extended period of time I'd like to investigate. If it's just a transitional error I can see in sentry that it "cleared" itself, so that's fine as well. I think most delivery issues require some manual intervention right? Even the As it is now it's too easy for django-mailer to not work at all without us being notified. P.S. as I was typing this message I got a sentry alert with the message |
Well, having the locking error logged at the error level just saved us from even more debugging. It turns out that the reload for the config change didn't clear the lock, so I had to manually clear it. I think in case of errors it's better to err on the side of being to loud instead of too quiet. It's fairly easy to fully ignore an error in Sentry (I think every type of error will be grouped individually in Sentry as the exception is part of the message), not getting notified about them however can be much more catastrophic. But if more fine grained handling/logging is required for you to merge/release this PR, I'd be happy to do so. I do need some guidance however, as I cannot decide what type of errors should be logged at |
As a workaround for the current behavior I resorted to a logging config with a special filter. It's slightly more complex than I would like, but it works:
|
We missed a critical configuration change (mailserver password had changed) last week and didn't notice until end users started complaining about not receiving mail. It took a while for us to figure out what the culprit was, luckily the error message is stored in the log table. However, it would be better if deliverability errors were logged with a higher log level so our error tracking system (Sentry) could've picked them up and alerted us.
It might be possible to use
logger.exception
here, but I'm not 100% sure.