From 977cf3c3831108679905f19aa66172a43daec32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sun, 21 Dec 2014 15:32:07 +0100 Subject: [PATCH] Added handler for uncaught exceptions to make sure those get logged --- src/octoprint/server/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 7f3c13de..96db4741 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -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