summaryrefslogtreecommitdiff
path: root/django/utils/log.py
diff options
context:
space:
mode:
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" % (