[Twisted-Python] Setting a different logger for Twistd

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Jun 8 11:10:10 EDT 2010

On 02:46 pm, landreville at deadtreepages.com wrote:
>I saw a few tickets and some mailing list messages similar to this
>question, but never saw a definitive answer.
>How do I go about using a different logger when I am using twistd?
>I have a file that defines the application object and I tried the
>following code in hopes that I could make the logger have max rotated
>logs set to a smaller number:
>application.setComponent(ILogObserver, FileLogObserver(logfile))

The log observer is just a callable that takes a log event.  So, you're 
close.  You just want to pass the `emit` method of that FileLogObserver 
observer instance, instead of the instance itself:

  application.setComponent(ILogObserver, FileLogObserver(logfile).emit)


More information about the Twisted-Python mailing list