Chris Withers wrote at 2005-7-13 09:40 +0100:
Ever noticed how tracebacks from ZPT are actually quite useful when viewed through the error_log object, but totally useless when they fail, say, in a unit test?
This bugged me, so I had a dig, and just discovered this cool monkey patch, to be inserted in any module that gets imported before an exception is raised:
I had a similar experience but solved it by modifying "zLOG.EventLogger.log" in the following way: # DM 2005-06-27: Zope style tracebacks from zExceptions.ExceptionFormatter import format_exception .... # DM 2005-06-27: we now use Zope's traceback format because # it is more informative #self.logger.log(level, msg, exc_info=(error is not None)) exc_class = sys.exc_info()[0] if error and exc_class is not None: # Note: "error" is a boolean! msg += '\n' + ''.join(format_exception(*sys.exc_info())) self.logger.log(level, msg) Maybe, code like this should move into the Zope core? -- Dieter