From ad6fcdb8d24d84a130f847f45b51d7e892ccca08 Mon Sep 17 00:00:00 2001 From: Daniel Sokolowski Date: Thu, 12 Sep 2013 10:04:28 -0400 Subject: [PATCH] Fixed #20844 -- Made AdminEmailHandler respect LOGGING 'formatter' setting. --- django/utils/log.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/django/utils/log.py b/django/utils/log.py index f1af7a249e..e7044741f0 100644 --- a/django/utils/log.py +++ b/django/utils/log.py @@ -84,24 +84,22 @@ class AdminEmailHandler(logging.Handler): record.getMessage() ) filter = get_exception_reporter_filter(request) - request_repr = filter.get_request_repr(request) + request_repr = '\n{0}'.format(filter.get_request_repr(request)) except Exception: subject = '%s: %s' % ( record.levelname, record.getMessage() ) request = None - request_repr = "Request repr() unavailable." + request_repr = "unavailable" subject = self.format_subject(subject) if record.exc_info: exc_info = record.exc_info - stack_trace = '\n'.join(traceback.format_exception(*record.exc_info)) else: exc_info = (None, record.getMessage(), None) - stack_trace = 'No stack trace available' - message = "%s\n\n%s" % (stack_trace, request_repr) + message = "%s\n\nRequest repr(): %s" % (self.format(record), request_repr) reporter = ExceptionReporter(request, is_email=True, *exc_info) html_message = reporter.get_traceback_html() if self.include_html else None mail.mail_admins(subject, message, fail_silently=True,