Added handler for uncaught exceptions to make sure those get logged

This commit is contained in:
Gina Häußge 2014-12-21 15:32:07 +01:00
parent 827ea36d72
commit 977cf3c383

View file

@ -216,6 +216,8 @@ class Server():
from tornado.ioloop import IOLoop
from tornado.web import Application
import sys
debug = self._debug
# first initialize the settings singleton and make sure it uses given configfile and basedir if available
@ -224,6 +226,9 @@ class Server():
# then initialize logging
self._initLogging(self._debug, self._logConf)
logger = logging.getLogger(__name__)
def exception_logger(exc_type, exc_value, exc_tb):
logger.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_tb))
sys.excepthook = exception_logger
logger.info("Starting OctoPrint %s" % DISPLAY_VERSION)
# then initialize the plugin manager