I've just completed a patch to the Python syslog module to add the method enable_exception_logging(). It sets up a sys.excepthook so that unhandled exceptions are logged to syslog. By default, it chains to the existing excepthook.
So, once this code gets accepted, you will be able to have exceptions logged by doing: "import syslog; syslog.enable_exception_logging()".
For Python software that runs from cron or init or Apache, it can be very useful to capture the exceptions in a persistent location.
I'd appreciate some reviews of the code, it's in Issue8214.comments powered by Disqus