[Web-SIG] OT: Exception report library

Ian Bicking ianb at colorstudy.com
Tue Jan 11 20:22:54 CET 2005


I originally sent this to comp.lang.python, but I didn't get much
response, so I'm hoping someone here has some opinion on exception
reports; this isn't specifically web related, but I am looking to use it
in WSGIKit (and elsewhere) and I'm hoping someone here has an opinion.

I've been using one of several systems to catch unexpected exceptions
and log them (e.g., write to a file, display on web page, email me,
etc).  But many are built into a particular system, or have an
interesting but incomplete set of features.  E.g., many web frameworks
have exception reporters (and the stdlib includes cgitb), but I want to
handle non-web exceptions in the same way as exceptions from web
requests, and that's not generally easy.

So, I'm figuring there should be some generic library that does this.
Does anyone have experience with one they could recommend?  PyCrash
comes to mind: http://pycrash.sourceforge.net/, though the XML output
doesn't excite me (but the post-mortem debugging data is nice).  py.test
makes nice tracebacks with extra data as well, and cgitb is another
option, though I've found the cgitb code to be poorly factored for
reusability when I've looked at it in the past.  Zope includes an
otherwise-Zope-neutral ExceptionFormatter, which isn't terribly
exciting, except that it does look for __traceback_info__ local
variables and create reports with those inlined.  Maybe there's
something better that's packaged as part of a larger framework?  Does
anyone have good or bad experience with PyCrash?

Localized application extensibility is really useful to me as well; for
instance, in a web application I like to know who the logged-in user is,
and all sorts of environment information, and there's no way to acquire 
that information that is common to all the environments I'd like this to 
work in.  On the reporting end configuration and hooks are also really 
useful; e.g., there's no general way to display an exception report on a 
web page, so a web framework would have to hook into it in some way as 
well.  (Maybe this isn't as true with WSGI, but I don't think there's 
any libraries written for WSGI anyway)

So I'm kind of looking for the best-of-breed for this particular 
functionality; adding the reports and logging is easy, it's really the 
nice traceback that I'm hoping to find.

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org



More information about the Web-SIG mailing list