Remove email notifications for exceptions, route to Sentry only#6001
Merged
Remove email notifications for exceptions, route to Sentry only#6001
Conversation
Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update exception handling to send notifications to Sentry
Remove email notifications for exceptions, route to Sentry only
Mar 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Removes Django’s admin exception email logging so that exceptions are reported via Sentry only, avoiding redundant notifications.
Changes:
- Removed the
django.utils.log.AdminEmailHandler(mail_admins) handler fromLOGGING. - Updated the
djangologger to no longer referencemail_admins.
Comment on lines
445
to
447
| "django": { | ||
| "handlers": ["console", "mail_admins"], | ||
| "handlers": ["console"], | ||
| "level": "INFO", |
There was a problem hiding this comment.
With mail_admins removed from the django logger, production exception notifications will now rely entirely on Sentry. Since sentry_sdk.init(...) is conditional on SENTRY_DSN being set, environments without SENTRY_DSN configured will no longer emit any exception alerts. Consider enforcing SENTRY_DSN when DEBUG is False (fail fast) or adding an explicit fallback handler for error-level logs in non-debug environments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Django's
AdminEmailHandlerwas configured alongside Sentry, causing exceptions to be emailed to admins redundantly. Sentry already captures all exceptions viasentry_sdkwithDjangoIntegration.Changes
blt/settings.py: Removedmail_adminshandler (django.utils.log.AdminEmailHandler) fromLOGGINGand dropped it from thedjangologger's handler list✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.