Commit 6421c26b authored by Matt Behrens's avatar Matt Behrens

#185 plus fix ajung's fix for #341: repair Z2.log for [FP]CGIServer, and

give them extended log format like HTTPServer
parent 6b7842c5
......@@ -437,10 +437,14 @@ class FCGIChannel(asynchat.async_chat):
DebugLogger.log('E', id(self))
user_agent=self.get_header('user-agent')
if not user_agent: user_agent=''
referer=self.get_header('referer')
if not referer: referer=''
if self.env.has_key('HTTP_USER_AGENT'):
user_agent=self.env['HTTP_USER_AGENT']
else:
user_agent=''
if self.env.has_key('HTTP_REFERER'):
referer=self.env['HTTP_REFERER']
else:
referer=''
if self.env.has_key('PATH_INFO'):
path=self.env['PATH_INFO']
......@@ -453,7 +457,7 @@ class FCGIChannel(asynchat.async_chat):
if self.addr:
self.server.logger.log (
self.addr[0],
'%s - - [%s] "%s %s" %d %d' % (
'%s - - [%s] "%s %s" %d %d "%s" "%s"' % (
self.addr[1],
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
......@@ -466,7 +470,7 @@ class FCGIChannel(asynchat.async_chat):
else:
self.server.logger.log (
'127.0.0.1 ',
'- - [%s] "%s %s" %d %d' % (
'- - [%s] "%s %s" %d %d "%s" "%s"' % (
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
time.localtime(time.time())
......
......@@ -141,6 +141,15 @@ class PCGIChannel(asynchat.async_chat):
return 1
def log_request(self, bytes):
if self.env.has_key('HTTP_USER_AGENT'):
user_agent=self.env['HTTP_USER_AGENT']
else:
user_agent=''
if self.env.has_key('HTTP_REFERER'):
referer=self.env['HTTP_REFERER']
else:
referer=''
if self.env.has_key('PATH_INFO'):
path=self.env['PATH_INFO']
else:
......@@ -153,24 +162,26 @@ class PCGIChannel(asynchat.async_chat):
if addr and type(addr) is TupleType:
self.server.logger.log (
addr[0],
'%d - - [%s] "%s %s" %d %d' % (
'%d - - [%s] "%s %s" %d %d "%s" "%s"' % (
addr[1],
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
time.gmtime(time.time())
time.localtime(time.time())
) + tz_for_log,
method, path, self.reply_code, bytes
method, path, self.reply_code, bytes,
referer, user_agent
)
)
else:
self.server.logger.log (
'127.0.0.1',
'- - [%s] "%s %s" %d %d' % (
' - - [%s] "%s %s" %d %d "%s" "%s"' % (
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
time.gmtime(time.time())
) + tz_for_log,
method, path, self.reply_code, bytes
method, path, self.reply_code, bytes,
referer, user_agent
)
)
......
......@@ -193,6 +193,9 @@ Zope Changes
(which will bail out if it doesnt get called with a tuple
argument)
- Collector #185, 341: PCGIServer and FCGIServer logs corrected
and now output extended information like HTTPServer does.
Zope 2.5.1 beta 1
Bugs Fixed
......
......@@ -437,10 +437,14 @@ class FCGIChannel(asynchat.async_chat):
DebugLogger.log('E', id(self))
user_agent=self.get_header('user-agent')
if not user_agent: user_agent=''
referer=self.get_header('referer')
if not referer: referer=''
if self.env.has_key('HTTP_USER_AGENT'):
user_agent=self.env['HTTP_USER_AGENT']
else:
user_agent=''
if self.env.has_key('HTTP_REFERER'):
referer=self.env['HTTP_REFERER']
else:
referer=''
if self.env.has_key('PATH_INFO'):
path=self.env['PATH_INFO']
......@@ -453,7 +457,7 @@ class FCGIChannel(asynchat.async_chat):
if self.addr:
self.server.logger.log (
self.addr[0],
'%s - - [%s] "%s %s" %d %d' % (
'%s - - [%s] "%s %s" %d %d "%s" "%s"' % (
self.addr[1],
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
......@@ -466,7 +470,7 @@ class FCGIChannel(asynchat.async_chat):
else:
self.server.logger.log (
'127.0.0.1 ',
'- - [%s] "%s %s" %d %d' % (
'- - [%s] "%s %s" %d %d "%s" "%s"' % (
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
time.localtime(time.time())
......
......@@ -141,6 +141,15 @@ class PCGIChannel(asynchat.async_chat):
return 1
def log_request(self, bytes):
if self.env.has_key('HTTP_USER_AGENT'):
user_agent=self.env['HTTP_USER_AGENT']
else:
user_agent=''
if self.env.has_key('HTTP_REFERER'):
referer=self.env['HTTP_REFERER']
else:
referer=''
if self.env.has_key('PATH_INFO'):
path=self.env['PATH_INFO']
else:
......@@ -153,24 +162,26 @@ class PCGIChannel(asynchat.async_chat):
if addr and type(addr) is TupleType:
self.server.logger.log (
addr[0],
'%d - - [%s] "%s %s" %d %d' % (
'%d - - [%s] "%s %s" %d %d "%s" "%s"' % (
addr[1],
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
time.gmtime(time.time())
time.localtime(time.time())
) + tz_for_log,
method, path, self.reply_code, bytes
method, path, self.reply_code, bytes,
referer, user_agent
)
)
else:
self.server.logger.log (
'127.0.0.1',
'- - [%s] "%s %s" %d %d' % (
' - - [%s] "%s %s" %d %d "%s" "%s"' % (
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
time.gmtime(time.time())
) + tz_for_log,
method, path, self.reply_code, bytes
method, path, self.reply_code, bytes,
referer, user_agent
)
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment