From daa8f38b4bf7be7d06bda6d8e78c9cbef548d20a Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Wed, 29 Aug 2012 10:19:04 +0200 Subject: [PATCH] Improve formatting of the exceptions on the console. --- rq/worker.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index f9466a44..21a93029 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -23,7 +23,6 @@ from .version import VERSION green = make_colorizer('darkgreen') yellow = make_colorizer('darkyellow') -red = make_colorizer('darkred') blue = make_colorizer('darkblue') logger = logging.getLogger(__name__) @@ -429,8 +428,10 @@ class Worker(object): def handle_exception(self, job, *exc_info): """Walks the exception handler stack to delegate exception handling.""" - exc_string = ''.join(traceback.format_exception(*exc_info)) - self.log.exception(red(exc_string)) + exc_string = ''.join( + traceback.format_exception_only(*exc_info[:2]) + + traceback.format_exception(*exc_info)) + self.log.error(exc_string) for handler in reversed(self._exc_handlers): self.log.debug('Invoking exception handler %s' % (handler,))