changeset 3156:1508feb6dbbf

logging: use logging.exception
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 01 Mar 2008 16:41:33 +0100
parents 7dd36ca5f4b3
children b8cb12fa571b
files MoinMoin/auth/ldap_login.py MoinMoin/auth/mysql_group.py MoinMoin/failure.py
diffstat 3 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/auth/ldap_login.py	Sat Mar 01 13:09:45 2008 +0100
+++ b/MoinMoin/auth/ldap_login.py	Sat Mar 01 16:41:33 2008 +0100
@@ -170,9 +170,6 @@
             return ContinueLogin(u)
 
         except:
-            import traceback
-            info = sys.exc_info()
-            logging.error("caught an exception, traceback follows...")
-            logging.error(''.join(traceback.format_exception(*info)))
+            logging.exception("caught an exception, traceback follows...")
             return CancelLogin(None)
 
--- a/MoinMoin/auth/mysql_group.py	Sat Mar 01 13:09:45 2008 +0100
+++ b/MoinMoin/auth/mysql_group.py	Sat Mar 01 16:41:33 2008 +0100
@@ -55,11 +55,7 @@
             m = MySQLdb.connect(host=self.host, user=self.user,
                                 passwd=self.passwd, db=self.dbname)
         except:
-            import sys
-            import traceback
-            info = sys.exc_info()
-            logging.error("authorization failed due to exception connecting to DB, traceback follows...")
-            logging.error(''.join(traceback.format_exception(*info)))
+            logging.exception("authorization failed due to exception connecting to DB, traceback follows...")
             return CancelLogin(_('Failed to connect to database.'))
 
         c = m.cursor()
--- a/MoinMoin/failure.py	Sat Mar 01 13:09:45 2008 +0100
+++ b/MoinMoin/failure.py	Sat Mar 01 16:41:33 2008 +0100
@@ -156,7 +156,7 @@
         raise err
 
     savedError = sys.exc_info()
-    logging.error('%s: %s' % (err.__class__.__name__, str(err)), exc_info=savedError)
+    logging.exception('An exception occured.')
     try:
         debug = 'debug' in getattr(request, 'form', {})
         # default to True here to allow an admin setting up the wiki