[Zope-dev] customizing Zope HTTP logs
Brian Takashi Hooper
brian@garage.co.jp
Mon, 03 Jul 2000 15:12:24 +0900
Hi there -
I want to customize the format of Zope's HTTP logs for a certain
project, so, reading the code I can see that the log() method of
medusa's http_request is used for this. In order to customize the log
format, I can of course just edit http_server.py to change the
http_request's log() method to do what I want, or alternately have code
that defines a new log() method and then just changes
medusa.http_server.http_request on startup (like, from z2.py). However,
I was thinking that wouldn't it be nicer to be able to subclass
http_request, say in ZServer/HTTPServer.py and customize the behavior of
http_request that way...? It looks like the only things that would be
affected would be a couple lines in medusa's http_channel class, where
http_request is instantiated:
...
r = http_request (self, request,
None, None, None, join_h
eaders(lines[1:]))
r.error(400)
return
header = join_headers (lines[1:])
r = http_request (self, request, command, uri, version,
header)
...
Do you think it would be reasonable to change this to something similar
to the way zhttp_channel/zhttp_server works, specifying request_class =
zhttp_request and then changing the above request lines to call
self.request_class instead? Then we can do (in HTTPServer.py):
class zhttp_channel:
...
request_class = zhttp_request
class zhttp_request:
def log(...)
...
Which seems nicer to me.
I guess this is really a request for a medusa change, is this a more
appropriate topic for the medusa list? Does anyone else like this idea?
--Brian Hooper
Digital Garage, Inc.