[Twisted-Python] Question on logging.

Shawn Church shawn at schurchcomputers.com
Sun Dec 28 05:05:32 EST 2008

My problem is that PyAmf uses the standard Python logging module and twisted
uses it's own logging module.  I would like to have a single logging
mechanism that can be specified via twistd.  I would also like to have more
control of the output of the twisted log.  After googling and reading
Glyph's essay on the logging module (
http://twistedmatrix.com/trac/wiki/TwistedLogging) I have came up with two

1) Simply configure the logging module with a logging.Handler subclass that
outputs to twisted.python.log.msg.  I can then add a custom LoggingObserver
to control the output.

2) I can use log.PythonLoggingObserver to redirect to the standard logging
module and use the standard logging formatting options and logging levels to
control output (taking into account the caveats pointed out by Glyph).

My questions are as follows:

1)  Are the above reasonable or am I missing something simpler?

2) When adding a LoggingObserver I am left with the LoggingObserver
initialized by twistd.  I can supress this with -l /dev/nul but it seems
better to eliminate it completely.  I guess I could just clear the
,observers property of the theLogPublisher singleton put that seems like an
implementation detail.  Again,  am I missing something?  Is there a way to
tell twistd to let me set up my logging manually?

Note,  I am using version 8.1.


Shawn Church
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20081228/5996c3d0/attachment.htm 

More information about the Twisted-Python mailing list