summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2011-09-02 03:04:02 +0000
committerJulien Phalip <jphalip@gmail.com>2011-09-02 03:04:02 +0000
commitde35a3ab14ca2fb88b4524c8ea0ebaa9e28eb85b (patch)
tree857f0513a4904a44d432cd178ecf94d003dfe3b5 /django
parent71f017b2a6677538f8c3578e33859d4586b5bea1 (diff)
Fixed #16736 -- Enabled the merging of user-supplied arguments to format the error emails' subject in `AdminEmailHandler`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16715 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/utils/log.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/django/utils/log.py b/django/utils/log.py
index 1c3fe70155..a8098fcd2a 100644
--- a/django/utils/log.py
+++ b/django/utils/log.py
@@ -31,15 +31,16 @@ if not logger.handlers:
logger.addHandler(NullHandler())
class AdminEmailHandler(logging.Handler):
- def __init__(self, include_html=False):
- logging.Handler.__init__(self)
- self.include_html = include_html
-
"""An exception log handler that emails log entries to site admins.
If the request is passed as the first argument to the log record,
request data will be provided in the email report.
"""
+
+ def __init__(self, include_html=False):
+ logging.Handler.__init__(self)
+ self.include_html = include_html
+
def emit(self, record):
try:
request = record.request
@@ -53,7 +54,7 @@ class AdminEmailHandler(logging.Handler):
except:
subject = '%s: %s' % (
record.levelname,
- record.msg
+ record.getMessage()
)
request = None
request_repr = "Request repr() unavailable."
@@ -62,7 +63,7 @@ class AdminEmailHandler(logging.Handler):
exc_info = record.exc_info
stack_trace = '\n'.join(traceback.format_exception(*record.exc_info))
else:
- exc_info = (None, record.msg, None)
+ exc_info = (None, record.getMessage(), None)
stack_trace = 'No stack trace available'
message = "%s\n\n%s" % (stack_trace, request_repr)