logging producing redundant entries

Peter Otten __peter__ at web.de
Fri Mar 31 13:17:10 EST 2006


Jed Parsons wrote:

> Am I somehow accumulating a growing list of loggers by having this code
> at the top of a zope Extension?

I'd rather look after the number of handlers which is probably growing and
causing your problem. Normally it shouldn't matter how often you repeat
the logging.getLogger(name) call as long as the name is always the same.
For easier diagnosis you can include the loggername ("%(name)s") in the
message.

Do you maintain a hierarchy of loggers (names with dots) with a handler for
each logger? Then it might help to set the loggers' 'propagate' attribute
to False.

Peter



More information about the Python-list mailing list