Detect Errors to Improve Error Logging in Google App Engine Python
===

Is there an elegant way to detect whether my google app engine application has had an error, and write out a much more detailed log when it does?

I have considerable "debug" level logging, but I would like to remove all that and only display the debug information when an error occurs. 