[New-bugs-announce] [issue6435] logging: cache the traceback text on formatter, instead of record

Sridhar Ratnakumar report at bugs.python.org
Wed Jul 8 04:18:04 CEST 2009


New submission from Sridhar Ratnakumar <sridharr at activestate.com>:

In Formatter.format():

           # Cache the traceback text to avoid converting it multiple 
times
            # (it's constant anyway)
            if not record.exc_text:
                record.exc_text = self.formatException(record.exc_info)

The result must ideally be cache on the formatter object (self) itself 
rather than the record object. Because, record object is reused in 
multiple handlers .. thus multiple formatters. If the first formatter, 
caches the traceback text, then subsequent formatters will use the same 
even though of them is apparently a custom Formatter with overridden 
`formatException`.

----------
components: Library (Lib)
messages: 90247
nosy: srid, vsajip
severity: normal
status: open
title: logging: cache the traceback text on formatter, instead of record
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6435>
_______________________________________


More information about the New-bugs-announce mailing list