I am using python logging module and I want to disable the console logging for some time but it doesn't work.
#!/usr/bin/python
import logging
logger = logging.getLogger() # this gets the root logger
# ... here I add my own handlers
#logger.removeHandler(sys.stdout)
#logger.removeHandler(sys.stderr)
print logging.handlers
# this will print [<logging.StreamHandler instance at ...>]
# but I may have other handlers there that I want to keep
logger.debug("bla bla")
The above code displays the "bla bla" on stdout and I don't know how can I safely disable the console handler. How can I bu sure that I temporary remove the console streamhandler and not another one?