[docs] [issue34590] "Logging HOWTO" should share an example of best practices for using logging in a library

Nathaniel Manista report at bugs.python.org
Thu Sep 6 15:17:38 EDT 2018


Nathaniel Manista <nathaniel at google.com> added the comment:

Something... related, that may perhaps belong in a separate issue, but that I want to at least mention here because it would be solved if logging-in-libraries best practices were authoritatively documented and exemplified: it's just too consarn easy to "hold [the logging module] wrong" and wind up with "No handlers could be found for logger" log spam: https://www.google.ca/search?q=site:stackoverflow.com+"No+handlers+could+be+found+for+logger". Why should a Logger object need to have .basicConfig() called on it after retrieval (where "retrieval" means "getLogger call") and before use anyway? Why can't it just be ready for use (at least as ready for use as .basicConfig makes it) when passed from the logging module to the logging-using module like nearly any other object passed from the standard library to standard-library-using code?

(The documentation says "No handlers could be found for logger" spam only happens pre-3.2, but some of my users at least think they see it in later Pythons.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34590>
_______________________________________


More information about the docs mailing list