tags:

views:

210

answers:

2

I've got a project where I'm using Twisted for my web server. When exceptions occur (such as network errors), it's printing to the console.

I've already got logging through Python's built-in log module - is there any way to tell the reactor to use that instead?

What's the usual pattern for this?

+3  A: 

Found it. It's actually quite easy:

from twisted.python import log
observer = log.PythonLoggingObserver(loggerName='logname')
observer.start()

You just set loggerName to the same logger name that you're using in logging.getLogger().

Dave
+1  A: 

Try using twisted.python.log

Justin Ethier