summaryrefslogtreecommitdiff
path: root/django/utils/log.py
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2024-04-09 16:01:37 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-04-12 10:37:28 +0200
commit50a702f3fd87e271945aa5e88ae8a39d7a2149fd (patch)
tree89289ca9a0e4b8c4651be0739ac54c072cc16fde /django/utils/log.py
parentb0f2289426d2af0d3f31e50bd8d5e60a49d62710 (diff)
Fixed #35364 -- Stopped AdminEmailHandler rendering email unnecessarily.
Diffstat (limited to 'django/utils/log.py')
-rw-r--r--django/utils/log.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/utils/log.py b/django/utils/log.py
index fd0cc1bdc1..a25b97a7d5 100644
--- a/django/utils/log.py
+++ b/django/utils/log.py
@@ -92,6 +92,13 @@ class AdminEmailHandler(logging.Handler):
)
def emit(self, record):
+ # Early return when no email will be sent.
+ if (
+ not settings.ADMINS
+ # Method not overridden.
+ and self.send_mail.__func__ is AdminEmailHandler.send_mail
+ ):
+ return
try:
request = record.request
subject = "%s (%s IP): %s" % (