[Twisted-Python] Twistd logging

Landreville landreville at deadtreepages.com
Wed Dec 9 13:14:43 EST 2009

On Wed, Dec 9, 2009 at 12:26 PM, <exarkun at twistedmatrix.com> wrote:

> On 8 Dec, 09:04 pm, landreville at deadtreepages.com wrote:
> >Is there a way I can customize the format of log file?
> >I want to add more information to each line (about the xmlrpc method
> >being
> >called), but I can't find where these lines get written out. I know I
> >can
> >print a message to the log in my _getFunction, but I would prefer to
> >have
> >one line per request.
> Are you talking about the CLF request log or the main log file (normally
> called "twistd.log")?
> The former can be controlled by overriding the "log" method of Site.
> The latter is controlled by the general log observer(s) which is
> installed.  You can read about customizing the log observer using .tac
> files in the online documentation:
>  http://twistedmatrix.com/documents/current/core/howto/application.html
I'm talking about the main log file (twistd.log) that is created. I want to
customize the lines that are written to it, the document only tells me how
to use a different observer, not how to format the lines that are being
output by twistd.

I would like to change the output from:
2009-12-09 12:59:01-0500 [-] - - [09/Dec/2009:17:59:01 +0000]
"POST /XMLRPC HTTP/1.0" 200 647 "-" "xmlrpclib.py/1.0.1 (by
to include "xmlrpc method: system.listMethods" at the end (or something
similar to include the methd name".

I see in the observers an eventDict is passed in to be output in the log,
but where does that eventDict get created/passed in?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20091209/901b46a8/attachment.htm 

More information about the Twisted-Python mailing list