[Twisted-web] twisted log files

Manlio Perillo manlio_perillo at libero.it
Sun Dec 10 11:23:47 CST 2006

Jean-Paul Calderone ha scritto:
> On Sun, 10 Dec 2006 12:55:18 +0100, Manlio Perillo 
> <manlio_perillo at libero.it> wrote:
>> Noah Gift ha scritto:
>>> I am not sure if awstats directly parses twisted log files,
>> I'm rather sure that it can not parse Twisted log file but there are 
>> two solution:
> Twisted Web will produce apache common log formatted logfiles if you ask
> it to.  Look at the arguments Site takes.

    def __init__(self, resource, logPath=None, timeout=60*60*12):

I can't see any options for changing log format.

The only thing I can change is the log method in HTTPFactory:

     def log(self, request):
         """Log a request's result to the logfile, by default in 
combined log format."""
         if hasattr(self, "logFile"):
             line = '%s - - %s "%s" %d %s "%s" "%s"\n' % (
                 # request.getUser() or "-", # the remote user is almost 
never important
                 '%s %s %s' % (self._escape(request.method),
                 request.sentLength or "-",
                 self._escape(request.getHeader("referer") or "-"),
                 self._escape(request.getHeader("user-agent") or "-"))

The combined log format should be supported by awstats.

Regards  Manlio Perillo

More information about the Twisted-web mailing list