How to prevent logging warning?

Peter Otten __peter__ at
Wed Oct 5 19:13:23 CEST 2005

Thomas Heller wrote:

> I want the script by default to be agnostic about the libraries
> logging.  When I want to see the log messages, I can always do
> logging.basicConfig()
> in the script to see the log messages.
> I get the behaviour that I want when I add a 'NULL' handler in the
> library, but is this really how logging is intended to be used?

I would support ...err, what's the opposite of a feature request?
Anyway, another hack, slightly more lightweight/intrusive:

logging.root.manager.emittedNoHandlerWarning = True


More information about the Python-list mailing list