[ZODB-Dev] Re: [Zope-dev] Re: zLOG module deprecated

Tim Peters tim.peters at gmail.com
Tue Jan 10 10:43:14 EST 2006


[Andreas Jung]
> ...
> Obviously ZEO (using TRACE) runs on Zope 3 without zLOG so specific
> extension can be handled locally.

ZEO also runs on Zopes 2.8 and 2.9 without zLOG -- zLOG hasn't been
used in ZODB since 3.2 (ZODBs 3.3, 3.4, 3.5, 3.6, and current trunk
contain no references to zLOG).

If Zope folk generally want more than the 5 logging levels that come
built in to Python's logging module, that's easy to supply, but then
it's also important that they define them with the same names and
numeric values.  ZODB's loglevels.py does so, and is the only
"extension" to Python's logging module ZODB made.  This is the code in
its entirety (but skipping the copyright boilerplate at the top --
Copyright (c) 2004 Zope Corporation and Contributors):

"""
import logging

__all__ = ["BLATHER", "TRACE"]

# In the days of zLOG, there were 7 standard log levels, and ZODB/ZEO used
# all of them.  Here's how they map to the logging package's 5 standard
# levels:
#
#    zLOG                         logging
#    -------------                ---------------
#    PANIC (300)                  FATAL, CRITICAL (50)
#    ERROR (200)                  ERROR (40)
#    WARNING, PROBLEM (100)       WARN (30)
#    INFO (0)                     INFO (20)
#    BLATHER (-100)               none -- defined here as BLATHER (15)
#    DEBUG (-200)                 DEBUG (10)
#    TRACE (-300)                 none -- defined here as TRACE (5)
#
# TRACE is used by ZEO for extremely verbose trace output, enabled only
# when chasing bottom-level communications bugs.  It really should be at
# a lower level than DEBUG.
#
# BLATHER is a harder call, and various instances could probably be folded
# into INFO or DEBUG without real harm.

BLATHER = 15
TRACE = 5
logging.addLevelName("BLATHER", BLATHER)
logging.addLevelName("TRACE", TRACE)
"""

When ZODB wants to use BLATHER or TRACE, it imports the symbolic name
from ZODB.loglevels instead of from logging.  That's all there is to
it -- it's trivial.  If Zope decided to keep BLATHER and TRACE too,
then a future ZODB release would presumably change to import BLATHER
and TRACE from the same place Zope gets them.


More information about the Zope-Dev mailing list