[Zope-dev] support for low level HTTP Response logging?

Romain Slootmaekers romain@zzict.com
Tue, 25 Feb 2003 13:08:09 +0100


Clemens Robbenhaar wrote:
> Hi Romain,
> 
>  > Yo,
>  > 
>  > searching the zope site and googling yielded too many data and no info, 
>  > so I might as well ask it here.
>  > 
>  > We are very interested in finding out the exact HTTP Responses that the 
>  > zope server pushes towards the client.
>  > 
>  > So is there a low level hook for logging the http responses ?
>  > We want the exact response, complete with all header info etc.
> 
>  There is no  explicit hook, but you might add Your logging code in 
> Zope/lib/python/ZPublicher/HTTPResponse.py, for example in the 'write'
> method of the HTTPResponse, or by wrapping the 'self.stdout' in __init__
> by something that also logs the output before writing to the passed
> 'stdout' stream. 

>  Of course this most probably will bring performance down (or even the
> complete Zope, if there is a simple typo in the hacked code ;-) I assume
> You only need this for testing.
> 

No. actually, it is for a production setup, so it would be preferable if 
it could be done without changing the zope source code [this gives all 
kinds of problems, extra work,... when we need to update a server]

We need this in our 3th line support, were we want to be able to follow 
all ins and outs for singled out user (fi filtered on cookie).
We also need to be able to turn this on/off at runtime.

We can sift out the user we want, turn off/on the logging, aso
in our own code, if we could just have a low level zope hook.
For the requests, we already have done this since there are plenty of 
hooks available. (yes, grep -i "someString" $(find ./ -name "*.py") is 
my friend ;) )

for Test/Development setups, we have plenty of options: proxying, 
sniffing, source code hacking, stepping with debugger,.....


Romain.