[Twisted-Python] Removing cruft from logs

Eric Mangold teratorn at twistedmatrix.com
Sun Feb 11 09:29:24 EST 2007

On Sun, 11 Feb 2007 06:10:04 -0600, Einar S. Idsø <einar at norsk-esport.no>  

> Hi,
> I am currently developing an application which will first and foremost
> be an xmlrpc server with an adbapi or sasync backend. The number of
> xmlrpc-requests is expected to be up to around a hundred per second.
> Unfortunately, the logging system by default logs the following for each
> and every request, leading to ridiculous logfiles:
> 2007/02/11 12:54 CET [HTTPChannel,0,] - -
> [11/Feb/2007:11:54:57 +0000] "POST /RPC2 HTTP/1.0" 200 122 "-"
> "xmlrpclib.py/1.0.1 (by www.pythonware.com)"
> It seems that even if I define my own logservice, as per example 11-5 in
> Abe Fettig's book, I am unable to catch and filter this logentry in the
> emit function before it is written to file. So I guess there's another
> LogObserver used by twistd, to which I have no direct access?
> What would be the proper way to get rid of this cruft?
> Cheers,
> Einar S. Idsø

I take it you're using twistd? In that case, yes, twistd adds a log  
observer when it starts. There also isn't any supported way of getting  
access to it. This and other issues are an unfortunate component of the  
present Twisted reality :)

Here's a hack:

 from twisted.python import log

Then your custom observer should be the only one left.

Hope that helps,
Eric Mangold
Twisted/Win32 Co-Maintainer

More information about the Twisted-Python mailing list