Commit c047e8dc authored by ale's avatar ale

catch and log unhandled exceptions

parent d12c2af6
......@@ -49,7 +49,7 @@ def setup_logging(foreground=False, debug=False):
handler = logging.handlers.SysLogHandler(address='/dev/log',
facility=3)
handler.setFormatter(logging.Formatter(
program_name + '[%(process)d]: (%(module)s) %(levelname)s: %(message)s'))
program_name + '[%(process)d]: %(levelname)s: %(message)s'))
logger.addHandler(handler)
if debug:
logger.setLevel(logging.DEBUG)
......@@ -114,6 +114,8 @@ def daemonize(opts, main_function, *args):
try:
main_function(*args)
except Exception:
log.exception('Unexpected exception')
finally:
if not opts.foreground:
pidfile.release()
......
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