add traceback information to exception messages callbacks
@@ -6,6 +6,8 @@ from __future__ import absolute_import, print_function
import logging
log = logging.getLogger(__name__)
+from traceback import format_exception
+
from tornado import gen
@gen.coroutine
@@ -80,7 +82,8 @@ class _AsyncPeriodic(object):
if not self._stopped:
self._loop.add_future(invoke(), on_done)
if future.exception() is not None:
- log.error("Error thrown from periodic callback: %r", future.exception())
+ log.error("Error thrown from periodic callback:")
+ log.error("".join(format_exception(*future.exc_info())))
self._loop.add_future(self.sleep(), on_done)
def stop(self):
