[Twisted-Python] disable twisted.web logging

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? Thanks in advance. -- Good luck, Pavel Bastov

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']) else: site = server.Site(myresource) This will let you pass either a log filename or /dev/null as a parameter. 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, -phil

Phil, your reply is very helpful. Thanks a lot. P.S. I will take your advice into account and next time will post to twisted-web. On Sun, Mar 30, 2008 at 7:03 AM, Phil Christensen <phil@bubblehouse.org> wrote:
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']) else: site = server.Site(myresource)
This will let you pass either a log filename or /dev/null as a parameter.
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,
-phil
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Good luck, Pavel Bastov xooChat Team Leader http://www.xoochat.com/
participants (2)
-
Pavel
-
Phil Christensen