[Twisted-Python] Handling (intercepting) exceptions in twisted

Itamar Shtull-Trauring itamar at itamarst.org
Sun Sep 12 14:30:34 MDT 2004


On Sun, 2004-09-12 at 16:06, Joshua Moore-Oliva wrote:
> Whenever an exception is raised, I would like to handle it instead of twisted so I can syslog and exit the application.
> 
> Is there an excepthook for twisted that I can override to provide this functionality?

Something along the lines of:

def f(**kwargs):
    if kwargs.has_key("failure"): # do your thing
twisted.python.log.addObserver(f)

# f will get called on all logged messages.

Note twisted has code (twisted.python.syslog) for hooking up the log system to syslog.





More information about the Twisted-Python mailing list