Log Exception with Backtrace

Heston James - Cold Beans heston.james at coldbeans.co.uk
Fri Oct 17 18:40:28 CEST 2008


Afternoon Guys, 

 

I'm currently logging exceptions within my applications like so:

 

try:

    #do something....

except Exception, error:

    # Log the exception.

    self.logger.error("Exception Occurred: (%s)" % str(error))

 

This is quite fine, however, sometimes I get very vague error message thrown
at me which don't help a great deal. How can I log the full exception and
backtrace as if it were thrown to stderr and I wasn't catching it?

 

Cheers all,

 

Heston

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081017/f9f70c24/attachment.html>


More information about the Python-list mailing list