Enable logging of unhandled exceptions

Use the traceback module to log unhandled exceptions to the logfile when
running as a daemon.
Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
parent b0b3ad51
......@@ -27,6 +27,7 @@ import time
import logging
import logging.handlers
import threading
import traceback
import subprocess
import daemon
......@@ -912,7 +913,13 @@ if __name__ == "__main__":
logger.addHandler(handler)
logging.info("Ready to serve requests")
proxy.serve()
try:
proxy.serve()
except Exception:
if opts.daemonize:
exc = "".join(traceback.format_exception(*sys.exc_info()))
logging.critical(exc)
raise
# vim: set ts=4 sts=4 sw=4 et :
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment