changeset 1586:cae5575b07fa

log tracebacks
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Sep 2006 22:36:07 +0200
parents a843bc5793fb
children 594c57bde21e
files MoinMoin/failure.py MoinMoin/request/__init__.py
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/failure.py	Mon Sep 25 22:17:59 2006 +0200
+++ b/MoinMoin/failure.py	Mon Sep 25 22:36:07 2006 +0200
@@ -6,7 +6,8 @@
 @copyright: 2004, 2005 by Nir Soffer <nirs@freeshell.org>
 @license: GNU GPL, see COPYING for details.
 """
-import sys, os
+import sys, os, logging
+
 from MoinMoin.support import cgitb
 
 
@@ -130,12 +131,13 @@
         return text
 
 
-def handle(request):
+def handle(request, err):
     """ Handle failures
     
     Display fancy error view, or fallback to simple text traceback
     """
     savedError = sys.exc_info()
+    logging.error('%s: %s' % (err.__class__.__name__, str(err)), exc_info=savedError)
     try:
         debug = ('debug' in getattr(request, 'form', {}) or
                  'MOIN_DEBUG' in os.environ)
--- a/MoinMoin/request/__init__.py	Mon Sep 25 22:17:59 2006 +0200
+++ b/MoinMoin/request/__init__.py	Mon Sep 25 22:36:07 2006 +0200
@@ -1275,9 +1275,8 @@
         # we should not generate the headers two times
         if not getattr(self, 'sent_headers', 0):
             self.emit_http_headers(['Status: 500 MoinMoin Internal Error'])
-        self.log('%s: %s' % (err.__class__.__name__, str(err)))
         from MoinMoin import failure
-        failure.handle(self)
+        failure.handle(self, err)
 
     def makeUniqueID(self, base):
         """