Removing default logging handler (causes duplicate logging)

Gal Aviel galaviel at
Tue Mar 4 13:29:52 CET 2008

Hello All,

I want to add a logger to my application, then addHandler to it to log to a
special destination.

Unfortunately when I use logging.getLogger("my_logger") to create the new
logger, it apparently comes with a default handler that logs to STDOUT (or
STDERR?). When I add my special handler it works Ok, but still logs to terminal,
which I do not want.

The only way I found to remove the default handler is by using

Is there a more elegant solution that uses the logging API?

my setup: Python 2.5.1 on Linux Suse 9. 

P.S.I am not using Basic config, just 'import logging' and then regular
logging.* calls.

Thanks in advance, 
Gal Aviel.

More information about the Python-list mailing list