Hello, I would like to introduce a small change into the great SiteErrorLog introduced in Zope 2.6.x. If you visit the error_log in the ZMI, you'll see many entries like: 21:42:06 Anonymous User (None) NotFound: <TABLE BORDER="0" WIDTH="100%"> <TR VALIGN="TOP"> <TD WIDTH="10%" The "Exception Value" for the ExceptionType "NotFound" is usually not very meaningful. Much more useful would be an entry like: 21:42:06 Anonymous User (None) NotFound: http://localhost:8080/url/not/found The only thing which needs a little patch is python/lib/Products/SiteErrorLog/www/main.pt: 87c87,88 < tal:content="python: len(value) < 70 and value or value[:70] + '...'"> ---
tal:content="python: test(entry['type']=='NotFound', entry['url'], len(value) < 70 and value or value[:70] + '...')">
Any thoughts or comments? Cheers, Maik
It seems reasonable to me to single this one out since its so common. -Casey On Sunday 06 April 2003 04:17 pm, Maik Jablonski wrote:
Hello,
I would like to introduce a small change into the great SiteErrorLog introduced in Zope 2.6.x. If you visit the error_log in the ZMI, you'll see many entries like:
21:42:06 Anonymous User (None) NotFound: <TABLE BORDER="0" WIDTH="100%"> <TR VALIGN="TOP"> <TD WIDTH="10%"
The "Exception Value" for the ExceptionType "NotFound" is usually not very meaningful. Much more useful would be an entry like:
21:42:06 Anonymous User (None) NotFound: http://localhost:8080/url/not/found
The only thing which needs a little patch is python/lib/Products/SiteErrorLog/www/main.pt:
87c87,88 < tal:content="python: len(value) < 70 and value or value[:70] + '...'"> ---
tal:content="python: test(entry['type']=='NotFound', entry['url'], len(value) < 70 and value or value[:70] + '...')">
Any thoughts or comments?
Cheers, Maik
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )
Casey Duncan wrote:
It seems reasonable to me to single this one out since its so common.
I've been using the attached patch for a while... it provides a bit more information about exactly where the request went wrong, by marking the un-traversed segment of the URL. Cheers, Evan @ 4-am Index: lib/python/Products/SiteErrorLog/SiteErrorLog.py =================================================================== RCS file: /cvs-repository/Releases/Zope/lib/python/Products/SiteErrorLog/SiteErrorLog.py,v retrieving revision 1.11.4.1 diff -u -r1.11.4.1 SiteErrorLog.py --- lib/python/Products/SiteErrorLog/SiteErrorLog.py 16 Oct 2002 21:34:36 -0000 1.11.4.1 +++ lib/python/Products/SiteErrorLog/SiteErrorLog.py 7 Apr 2003 15:28:49 -0000 @@ -151,6 +151,10 @@ username = None userid = None req_html = None + try: + strv = str(info[1]) + except: + strv = '<unprintable %s object>' % str(type(info[1]).__name__) if request: url = request.get('URL', '?') usr = getSecurityManager().getUser() @@ -160,11 +164,13 @@ req_html = str(request) except: pass - - try: - strv = str(info[1]) - except: - strv = '<unprintable %s object>' % str(type(info[1]).__name__) + if strtype == 'NotFound': + strv = url + next = request['TraversalRequestNameStack'] + if next: + next = list(next) + next.reverse() + strv = '%s [ /%s ]' % (strv, '/'.join(next)) log = self._getLog() entry_id = str(now) + str(random()) # Low chance of collision
participants (3)
-
Casey Duncan -
Evan Simpson -
Maik Jablonski