[Zodb-checkins] CVS: Zope3/src/ZODB - Mount.py:1.24
Tim Peters
tim at zope.com
Fri Apr 23 12:24:53 EDT 2004
[Tim Peters]
>> So some things have been picking apart log messages, and some
>> breakage is expected in those areas.
[Gintautas Miliauskas]
> Well, in that case, do you think it's OK to convert ZEO to use
> 'logging' and worry about log trawlers later?
Oh yes! zLOG must go in ZODB/ZEO -- it's dead weight now, hurting more than
it helps. The reality is that some log-crawlers will break, but so it goes.
Note one miserable subtlety: a lot of ZEO's zLOG calls stuff variable
information into the zLOG "subsystem name" (zLOG.log()'s first argument),
like the process id, the current thread name, and even the (hostname, port)
pair for socket connections. The usual pattern for conversion changes
zLOG.log(subsystem_name, ...)
to
logger = logging.getLogger(subsystem_name)
logger.log(...)
The problem is that logger objects are currently immortal (the logging
package holds on to them forever, in an internal dict mapping name to logger
object), so every unique subsystem_name used burns memory forever after (for
the dict entry, for the string name, and for the logger object). That isn't
good for long-running systems (like ZEO), so care will be needed when
converting ZEO logging to prevent unbounded memory growth -- we have to
ensure that the total set of subsystem names stays bounded. OTOH, it's
still important to get that info (pid, thread name, connection addresses)
into the log messages.
> I suppose people who care about the trawlers will fix them theirselves.
> Perhaps this is not a very friendly attitude, but I'm not sure if can
> test the trawlers thoroughly enough.
I doubt fixing these things requires more than small, local changes to
regular expressions in the trawlers. But since there are no tests of these
things, and reverse-engineering a regular expression you didn't write can
take months <wink>, I don't intend to try to do anything about them in
advance (unless an unexpected large block of free time appears).
> P.S. I found the majority of loggers in ZODB using 'zodb' (lowercase)
> as a prefix; ZODB/lock_file.py uses 'ZODB'. I think it would be a
> good idea to convert them all to 'ZODB', since that is the package
> name. Would you agree?
Yes. Good eye! Much of the ZODB 3.3 code was backported from ZODB4, where
ZODB was spelled "zodb". I expect that's where the lowercase "zodb"
instances came from, and they don't make good sense anymore.
More information about the Zodb-checkins
mailing list