diff --git a/src/vpoller/task/decorators.py b/src/vpoller/task/decorators.py index 014f6a5..671a61e 100644 --- a/src/vpoller/task/decorators.py +++ b/src/vpoller/task/decorators.py @@ -30,6 +30,7 @@ from functools import wraps from traceback import format_exc +from vpoller.log import logger from vpoller.task.core import Task from vpoller.task.registry import registry @@ -52,11 +53,13 @@ def wrapper(*args, **kwargs): try: result = fn(*args, **kwargs) except Exception as e: + tb = format_exc() result = { 'success': 1, 'msg': 'Task {} failed'.format(name), - 'traceback': format_exc() + 'traceback': tb } + logger.warning('Task %s failed: %s', name, tb) finally: return result t = Task(name=name, function=wrapper, required=required)