logging producing redundant entries
alex23
wuwei23 at gmail.com
Thu Mar 30 23:35:52 EST 2006
Jed Parsons wrote:
> My problem is that, for every event logged, the logger is producing
> multiple identical entries with the timestamp the same down to the
> millisecond.
> import logging
> # basicConfig for python 2.3
> logging.basicConfig()
[...]
> _logger.addHandler(_handler)
I think the problem might be that basicConfig does a lot more than you
seem to be aware:
> basicConfig( ) :
> Does basic configuration for the logging system by creating a StreamHandler with
> a default Formatter and adding it to the root logger. The functions debug(), info(),
> warning(), error() and critical() will call basicConfig() automatically if no handlers
> are defined for the root logger.
So basicConfig is creating a default handler and you're then adding
another, so two entries for every event.
Hope this helps.
- alex23
More information about the Python-list
mailing list