[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Vinay Sajip
Vinay Sajip added the comment: [snip example of how to achieve same effect as recipe in a simpler way] >> How will this differ in its effect from your recipe? > Actually, I did not know about 'Filter' until now. I will give it a > try sometime. Wouldn't it improve your recipe further to use mo

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Sridhar Ratnakumar
Sridhar Ratnakumar added the comment: > Vinay Sajip added the comment: > >> But the cache needs to be invalidated when `exc_info` is changed - >> as in set to None when it was a traceback object. > > When does the exc_info change for a record? AFAIK it's set when you > create a LogRecord, and t

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Vinay Sajip
Vinay Sajip added the comment: > But the cache needs to be invalidated when `exc_info` is changed - > as in set to None when it was a traceback object. When does the exc_info change for a record? AFAIK it's set when you create a LogRecord, and that's it. To be honest, I'm not sure why you nee

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Sridhar Ratnakumar
Sridhar Ratnakumar added the comment: > 2. The exception text needs to be stored in the record, because in some > instances (e.g. pickling and sending over a socket) this information > will not be available at the other end in any other way. Caching in the record object is thus the way to go. B

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Vinay Sajip
Vinay Sajip added the comment: > Not thoroughly .. as I missed the point 1. on formatter processing > multiple records. But what do you say to points 2, 3 and 4? Of course they may not apply to your use case, but are they not valid points? -- ___

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-09 Thread Sridhar Ratnakumar
Sridhar Ratnakumar added the comment: On Wed, 08 Jul 2009 23:59:17 -0700, Vinay Sajip wrote: > 1. The exception text cannot be cached in the formatter because a > formatter will format lots and lots of records. Formatters live for a > long time, records do not. Ah, yes. > Are you sure you'

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-08 Thread Vinay Sajip
Vinay Sajip added the comment: I fail to follow your logic, in the following respects: 1. The exception text cannot be cached in the formatter because a formatter will format lots and lots of records. Formatters live for a long time, records do not. 2. The exception text needs to be stored in t

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-08 Thread Sridhar Ratnakumar
Sridhar Ratnakumar added the comment: A real-life recipe where this bug showed up: http://code.activestate.com/recipes/576836/ -- ___ Python tracker ___ _

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-07 Thread Sridhar Ratnakumar
Sridhar Ratnakumar added the comment: For example, see: http://paste.pocoo.org/show/127167/ -- ___ Python tracker ___ ___ Python-bugs-

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-07 Thread Sridhar Ratnakumar
Changes by Sridhar Ratnakumar : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue6435] logging: cache the traceback text on formatter, instead of record

2009-07-07 Thread Sridhar Ratnakumar
New submission from Sridhar Ratnakumar : 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 resul