[Python-Dev] Loggers in the stdlib and logging configuration APIs

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue Dec 28 19:28:07 CET 2010


Glenn Linderman <v+python <at> g.nevcal.com> writes:

>     I didn't dig through the logging docs to discover if there is an API
>     that returns a list of currently known loggers.... such that an
>     application could easily discover the current set.  It would be nice
>     to have such a thing, in any case, but especially in the presence of
>     the leave_enabled flag.

There isn't one, though I'll see about providing it in 3.3.

>     I hope somewhere in the parts of the documentation I haven't read
>     yet, that there is some verbiage that discusses the fact that
>     loggers created after xxxConfig time and not configured by it, are

Not quite; the fact that existing loggers are disabled by the configuration
calls is documented, as that would be the thing that might be unexpected. That
newly-created loggers would be enabled isn't documented specifically, as it is
what one would expect.

>     enabled by default?  And the concept that applications that use
>     logging should be prepared to handle messages that they haven't seen
>     before in some manner.

That concept is also not mentioned explicitly, because the rationale given for
having a logging module in the stdlib is that it can be used by modules from
different sources (standard library, 3rd party libs, application code) and
provide logs in an integrated manner. So the expectation you describe would
follow naturally.

Thanks for the feedback,


Vinay Sajip



More information about the Python-Dev mailing list