From d42e8ecb11ead2d90c2d63e9e051c8f778e0e410 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 15 Mar 2013 12:00:28 -0400 Subject: [PATCH] Log handlers: Provide the actual error message on errors. Previously when we logged errors using logging.error() but didn't throw an exception, we would send these totally useless error humbugs/emails that look like this: Error generated by Anonymous user (not logged in) No stack trace available This change makes those messages include the actual text passed to logging.error(), which is substantially more useful. (imported from commit 76a8220ffe66d19cb0ca8ba9d1b42d5ecc4fd511) --- zephyr/handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zephyr/handlers.py b/zephyr/handlers.py index c1dc5bee1b..4193a6be07 100644 --- a/zephyr/handlers.py +++ b/zephyr/handlers.py @@ -60,7 +60,7 @@ class AdminHumbugHandler(logging.Handler): request_repr += "- %s: \"%s\"\n" % (field, request.META.get(field, "(None)")) request_repr += "~~~~" except Exception: - request_repr = "Request repr() unavailable." + request_repr = "Log record message:\n%s" % (record.getMessage(),) subject, stack_trace, user_info = format_record(record) @@ -95,7 +95,7 @@ class HumbugAdminEmailHandler(AdminEmailHandler): request_repr = filter.get_request_repr(request) except Exception: request = None - request_repr = "Request repr() unavailable." + request_repr = "Log record message:\n%s" % (record.getMessage(),) subject, stack_trace, user_info = format_record(record) message = "Error generated by %s\n\n%s\n\n%s" % (user_info, stack_trace,