From 735a4452dfde6aa9327406f842692a171e72a92f Mon Sep 17 00:00:00 2001 From: Deniz Turgut Date: Wed, 3 Jun 2015 17:01:06 -0400 Subject: [PATCH] Fix exception logging Adds exception type to the exception logging. Removes the extra logging for autoreload in debug mode, since `raise` will make it caught by the global `try/except` below and it'll be logged there. This replaces #1723 and also removes extra exception logging caused in #1718. --- pelican/__init__.py | 1 - pelican/log.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pelican/__init__.py b/pelican/__init__.py index 12da111a..2073564c 100644 --- a/pelican/__init__.py +++ b/pelican/__init__.py @@ -444,7 +444,6 @@ def main(): except Exception as e: if (args.verbosity == logging.DEBUG): - logger.critical('Internal failure: %r', e, exc_info=True) raise logger.warning( 'Caught exception "%s". Reloading.', e) diff --git a/pelican/log.py b/pelican/log.py index cd750927..c83c5810 100644 --- a/pelican/log.py +++ b/pelican/log.py @@ -149,7 +149,7 @@ class SafeLogger(logging.Logger): so convert the message to unicode with the correct encoding ''' if isinstance(arg, Exception): - text = str(arg) + text = '%s: %s' % (arg.__class__.__name__, arg) if six.PY2: text = text.decode(self._exc_encoding) return text