Commit 77015590 authored by Evan Simpson's avatar Evan Simpson

Make log entries for NotFound more useful and readable.

parent 9dc3cc85
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Site error log module. """Site error log module.
$Id: SiteErrorLog.py,v 1.14 2003/01/05 16:19:57 yuppie Exp $ $Id: SiteErrorLog.py,v 1.15 2003/02/07 18:16:37 evan Exp $
""" """
import os import os
...@@ -151,6 +151,10 @@ class SiteErrorLog (SimpleItem): ...@@ -151,6 +151,10 @@ class SiteErrorLog (SimpleItem):
username = None username = None
userid = None userid = None
req_html = None req_html = None
try:
strv = str(info[1])
except:
strv = '<unprintable %s object>' % type(info[1]).__name__
if request: if request:
url = request.get('URL', '?') url = request.get('URL', '?')
usr = getSecurityManager().getUser() usr = getSecurityManager().getUser()
...@@ -160,11 +164,13 @@ class SiteErrorLog (SimpleItem): ...@@ -160,11 +164,13 @@ class SiteErrorLog (SimpleItem):
req_html = str(request) req_html = str(request)
except: except:
pass pass
if strtype == 'NotFound':
try: strv = url
strv = str(info[1]) next = request['TraversalRequestNameStack']
except: if next:
strv = '<unprintable %s object>' % str(type(info[1]).__name__) next = list(next)
next.reverse()
strv = '%s [ /%s ]' % (strv, '/'.join(next))
log = self._getLog() log = self._getLog()
entry_id = str(now) + str(random()) # Low chance of collision entry_id = str(now) + str(random()) # Low chance of collision
......
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