
On Sun, 28 Dec 2008 02:05:32 -0800, Shawn Church shawn@schurchcomputers.com wrote:
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 solutions:
- 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.
- 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:
- Are the above reasonable or am I missing something simpler?
Reasonable? I'm not sure what you mean by that. Are they correct? Sure.
- 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?
There's no way to tell twistd that in 8.1. However, see http://twistedmatrix.com/trac/ticket/638 and http://twistedmatrix.com/trac/ticket/3534
Jean-Paul