[ZODB-Dev] Re: zLOG and format_exception

Guido van Rossum guido@python.org
Mon, 04 Nov 2002 16:47:18 -0500


> > Maybe zLOG should *not* try to use this (see
> > lib/python/zLOG/FormatException.py) but always fall back to the
> > standard traceback module's format_exception?
> 
> Yes, I think you're right.  zLOG should go back to using the
> never-fail traceback formatter.

OK, done in the CVS trunk.  This will take effect in Zope 2.7;
somebody else should decide if this is worth doing in 2.6.

Another potential concern: a while ago, when I changed
zLOG.MinimalLogger.py to use the textwrap module to wrap the log
entries, I also changed it to write everything in a single write()
system call.  This is important when multiple threads or processes are
appending to the same log file.  But it has one downside, perhaps
illustrated by ChrisW's original complaint: if something catastrophic
(like an infinite loop or a segfault) ever happens during the
formatting of the exception, you'll get *nothing* in the log.

The old approach logs the error message before logging the traceback,
which means that if the formatting segfaults, you'll still see the
error message.  I *think* that this is no longer a concern once we use
the traceback module's format_exception() function, but I could be
convinced otherwise by opinions from the field.

BTW, I believe I've seen checkins to use Vinay Sanjip's logging module
in favor of MinimalLogger.  But I don't see this in my checkout.  Was
it in a branch?  Or in Zope3?

--Guido van Rossum (home page: http://www.python.org/~guido/)