[Zope-dev] log levels

Chris Withers chris at simplistix.co.uk
Wed Oct 5 05:05:17 EDT 2005


Florent Guillaume wrote:
> For instance the transaction code logs at DEBUG level every  transaction 
> start and end (self.log.debug(...)). This makes the logs  very verbose, 
> and any other code I write that logs at DEBUG level  gets drowned in it. 
> Previously transaction logs were at TRACE level  but this doesn't exist 
> anymore, and the python logging framework  doesn't have anything between 
> INFO and DEBUG or below DEBUG.

Well, it supports numeric log levels, and you can define your own log 
levels too.

I'd suggest the transaction code either logs at a numeric level:

logger.log(-100,...)

or we define another logging level for TRACE:

import logging
logging.TRACE = logging.DEBUG - 10
logging.addLevelName(logging.TRACE,'TRACE')

...which can then be used in the transaction code as follows:

logger.log(logging.TRACE,...)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope-Dev mailing list