changeset 5275:adb58cd3ece2

main exception handler: include request url in log output
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 13 Nov 2009 07:25:08 +0100
parents c3b272d83749
children 195db0fdbb80
files MoinMoin/wsgiapp.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wsgiapp.py	Thu Nov 12 12:53:25 2009 +0100
+++ b/MoinMoin/wsgiapp.py	Fri Nov 13 07:25:08 2009 +0100
@@ -245,6 +245,7 @@
 
     def __call__(self, environ, start_response):
         try:
+            request = None
             request = self.Request(environ)
             context = init(request)
             response = run(context)
@@ -255,8 +256,10 @@
             # this is stuff the user should see on the web interface:
             response = fatal_response(e)
         except Exception, e:
+            # we avoid raising more exceptions here to preserve the original exception
+            url_info = request and ' [%s]' % request.url or ''
             # have exceptions logged within the moin logging framework:
-            logging.exception("An exception has occurred.")
+            logging.exception("An exception has occurred%s." % url_info)
             # re-raise exception, so e.g. the debugger middleware gets it
             raise