[New-bugs-announce] [issue1295] logging records cache the result of formatException()

Thomas Heller report at bugs.python.org
Thu Oct 18 17:30:36 CEST 2007

New submission from Thomas Heller:

I needed two logging handlers in my application, one notifiying the user
of errors, the other writing errors to a logfile.  So I created a custom
subclass of logging.Formatter and redefined the formatException() method
that returned a summary of the exception like 'ZeroDivisionError'
instead of the full traceback.

Unfortunately the logging record caches the result of the
handler.formatException() call in the exc_text variable, and the
formatException() method of the second handler isn't called at all.

The attached patch removes the caching and fixes the problem.

components: Library (Lib)
files: logging.patch
keywords: patch
messages: 56525
nosy: theller
severity: normal
status: open
title: logging records cache the result of formatException()
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6, Python 3.0
Added file: http://bugs.python.org/file8563/logging.patch

Tracker <report at bugs.python.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logging.patch
Type: text/x-patch
Size: 1109 bytes
Desc: not available
Url : http://mail.python.org/pipermail/new-bugs-announce/attachments/20071018/78cc6184/attachment-0001.bin 

More information about the New-bugs-announce mailing list