Let logging module handle traceback printing

Manually including the traceback in the log msg causes some issues when
interacting with log formats, and in one case was causing the traceback
to be printed twice.
This commit is contained in:
bloodearnest 2016-02-05 11:11:37 +00:00
parent d6a47e8aa2
commit 0acfb55d5f

View File

@ -207,8 +207,8 @@ class Arbiter(object):
except SystemExit: except SystemExit:
raise raise
except Exception: except Exception:
self.log.info("Unhandled exception in main loop:\n%s", self.log.info("Unhandled exception in main loop",
traceback.format_exc()) exc_info=1)
self.stop(False) self.stop(False)
if self.pidfile is not None: if self.pidfile is not None:
self.pidfile.unlink() self.pidfile.unlink()
@ -518,14 +518,13 @@ class Arbiter(object):
except SystemExit: except SystemExit:
raise raise
except AppImportError as e: except AppImportError as e:
self.log.debug("Exception while loading the application: \n%s", self.log.debug("Exception while loading the application",
traceback.format_exc()) exc_info=1)
print("%s" % e, file=sys.stderr) print("%s" % e, file=sys.stderr)
sys.stderr.flush() sys.stderr.flush()
sys.exit(self.APP_LOAD_ERROR) sys.exit(self.APP_LOAD_ERROR)
except: except:
self.log.exception("Exception in worker process:\n%s", self.log.exception("Exception in worker process"),
traceback.format_exc())
if not worker.booted: if not worker.booted:
sys.exit(self.WORKER_BOOT_ERROR) sys.exit(self.WORKER_BOOT_ERROR)
sys.exit(-1) sys.exit(-1)