On 02:46 pm, landrevi...@deadtreepages.com wrote:
Hello,
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:

logfile = LogFile(LOG_FILE, LOG_DIRECTORY, LOG_SIZE, maxRotatedFiles=MAX_LOGS)
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)

Jean-Paul

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to