Logging module gives duplicate log entries

Shiao multiseed at gmail.com
Tue Aug 21 18:27:43 EDT 2007


Maybe my question wasn't very clear. What I meant is that these four
lines lead in my case to two entries per logged event:

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

However if I REPLACE the above by:

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

things work as expected.




More information about the Python-list mailing list