Vinay Sajip added the comment:

I don't consider this a bug, as the logging documentation for the 
Handler.format() method states:

"Note that the formatted exception information is cached in attribute exc_text. 
This is useful because the exception information can be pickled and sent across 
the wire, but you should be careful if you have more than one Formatter 
subclass which customizes the formatting of exception information. In this 
case, you will have to clear the cached value after a formatter has done its 
formatting, so that the next formatter to handle the event doesn’t use the 
cached value but recalculates it afresh."

So, your suggested workaround is following the approach suggested in the 
documentation.

We could change the implementation to allow a cache_exception_text attribute 
(defaulting to True, set in the Handler class), then it could be set to False 
for individual instances by application developers. This does introduce another 
attribute to the handler class, so this would have to be added in 3.7 and not 
in 3.6. I'm not sure it's worth making this change, because the use case for it 
is not that common.

----------
resolution:  -> not a bug
status: open -> pending

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29056>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to