[ python-Bugs-1501699 ] method format of logging.Formatter caches incorrectly
SourceForge.net
noreply at sourceforge.net
Thu Jun 22 18:46:12 CEST 2006
Bugs item #1501699, was opened at 2006-06-06 15:14
Message generated for change (Comment added) made by vsajip
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1501699&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Boris Lorbeer (blorbeer)
Assigned to: Vinay Sajip (vsajip)
Summary: method format of logging.Formatter caches incorrectly
Initial Comment:
The format method of logging.Formatter is buggy in that
it doesn't call the method formatException if the cache
record.exc_text is set. If you have two Formatters that
should format the same log record differently (i.e. each
has its own overriding formatException method), the
formatException method of the second formatter will
never be called because the cache has been set by the
first formatter. The proper way of using the cache is
IMHO to check the cache only in the method
formatException of logging.Formatter.
----------------------------------------------------------------------
>Comment By: Vinay Sajip (vsajip)
Date: 2006-06-22 16:46
Message:
Logged In: YES
user_id=308438
It's not a bug, it's by design. The formatException method
only takes the exception info as a parameter, and to change
the method signature now could break some people's code, right?
A solution would be for you to also override the format
method in your custom formatter classes and set
record.exc_text to None if you want to invalidate the cache
before calling the base class implementation.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1501699&group_id=5470
More information about the Python-bugs-list
mailing list