From 33ecc8a5d2240b03226548e72bd541faf600e342 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Tue, 12 Mar 2019 01:07:30 +0000 Subject: [PATCH] issue #507: log fatal errors to syslog. Next round should log entire exception text, but this is useful enough already. --- mitogen/core.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index b97360f1..0890735d 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -50,6 +50,7 @@ import signal import socket import struct import sys +import syslog import threading import time import traceback @@ -3245,8 +3246,10 @@ class Broker(object): fire(self, 'shutdown') self._broker_shutdown() - except Exception: - LOG.exception('_broker_main() crashed') + except Exception as e: + LOG.exception('broker crashed') + syslog.syslog(syslog.LOG_ERR, 'broker crashed: %s' % (e,)) + syslog.closelog() # prevent test 'fd leak'. self._alive = False # Ensure _alive is consistent on crash. self._exitted = True