[Twisted-Python] disable twisted.web logging

Phil Christensen phil at bubblehouse.org
Sat Mar 29 21:03:41 EDT 2008

On Mar 29, 2008, at 1:39 AM, Pavel wrote:
> Hi all,
> is there any way to disable twisted.web logging? Or at least
> control it somehow, e.g. filter and log only necessary entries.
> Also, is there any way to make http requests be logged into  
> separate file?

FYI, posts like this should probably go to the twisted-web mailing list.

I'm not sure what level of control you'd like over the access log,  
but for simple redirection, it's straightforward. Here's how I build  
the Site object:

     myresource = MyResource()
     if(config['logfile'] != '-'):
         site = server.Site(myresource, logPath=config['logfile'])
         site = server.Site(myresource)

This will let you pass either a log filename or /dev/null as a  

If you'd like more control (like logging different kinds of requests  
to different files), you'll need to get into the LogObserver stuff in  
twisted.python.log... I've only used t.p.log to create custom  
loggers, though, I'm not sure what's involved in filtering t.web's  
log messages....

Hope this helps,


More information about the Twisted-Python mailing list