extended logging

lou@h... lou@h...
Fri, 13 Apr 2001 21:49:22 -0000


I found the answer in a zope archive:
http://zope.nipltd.com/public/lists/zope-archive.nsf/242bb7cc2b2c343d802568ab003585d4/b5bad84d0e217ff280256994000ace5f?OpenDocument


In ZServer/medusa/http_server.py, the "log" method of the class
"http_request" can be modified to report the request hostname which
is readily available via the get_header method in the same class. Here
is my modified "log" method:


def log (self, bytes):
user_agent=self.get_header('user-agent')
if not user_agent: user_agent=''
referer=self.get_header('referer')
#ADD
host=self.get_header('host')
if not referer: referer='' 
self.channel.server.logger.log (
self.channel.addr[0],
#ADD %S
' - - [%s] "%s" %d %d "%s" "%s" %s\n' % (
self.log_date_string (time.time()),
self.request,
self.reply_code,
bytes,
referer,
user_agent,
# ADD host
host
)
)
This will add the host portion of the http header to the end of each
log entry.

where can I find the complete list of get_header returns???

Lou
--- In medusa@y..., lou@h... wrote:
> I am using the version of medusa that came bundled with zope. Has 
> anyone extended logging as to add the host header information. I
have 
> found the log routine but I do not know what variable name to 
> reference this. Thanks in advance.
> 
> Lou