Logging module gives duplicate log entries

Shiao multiseed at gmail.com
Tue Aug 21 15:17:28 CEST 2007


Hi,
I am getting duplicate log entries with the logging module.

The following behaves as expected, leading to one log entry for each
logged event:

logging.basicConfig(level=logging.DEBUG, filename='/tmp/foo.log')

But this results in two entries for each logged event:

applog = logging.getLogger()
applog.setLevel(logging.DEBUG)
hdl = logging.FileHandler('/tmp/foo.log')
applog.addHandler(hdl)


The app is based on the web.py framework, so I guess my problem may
be
connected to be some interaction with other uses of logging within
the
framework. This is not specific to the root logger, the same happens
with logging.getLogger('foo').

Any clue would be more than welcome.

best,
ShiaoBu




More information about the Python-list mailing list