On 12/7/10 4:59 PM, Robert Kern wrote:
On 12/7/10 2:26 PM, Vinay Sajip wrote:
This issue was brought to my notice today:

http://bugs.python.org/issue10626

and reference was made in the comments to possible obstacles facing stdlib
maintainers who might wish to use logging in the stdlib and in its unit tests.

From my perspective and as mentioned in the logging documentation, library code
which uses logging should add a NullHandler instance to any top-level logger,
which will avoid any "No handlers could be found for logger XXX" message if no
logging handlers have been set up.

I've done that before in my own library code, then quickly realized that it was
a bad idea. Adding a NullHandler silently prevents logging.basicConfig() from
working.

Only on the root handler. Forget this bit of my argument (and the statements that directly follow from it). The rest of my argument should stand on its own, though.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to