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

Nick Coghlan ncoghlan at gmail.com
Tue Dec 28 09:53:12 CET 2010


On Tue, Dec 28, 2010 at 6:28 PM, Glenn Linderman <v+python at g.nevcal.com> wrote:
> On 12/28/2010 12:19 AM, Vinay Sajip wrote:
>
>> calls can support three levels of logger disabling:
>> - leave all existing loggers enabled (existing option)
>
> I think you mean disabled - that's the current behaviour.
>
>> - leave only flagged loggers enabled (new default behaviour)
>> - disable all loggers not mentioned explicitly (new option)
>
> My words in his mouth, but I think he meant that the existing _default_
> behavior should be changed, and the existing option (listed first), which is
> not default behaviour should be kept, and a third option to sort of achieve
> the current default behavior, but make it harder.

It isn't really about making it harder - it is about changing the
default behaviour in a backwards compatible way.

As I see it, library level loggers (including those in the standard
library) should be left enabled unless explicitly turned off, while
application level loggers should be left disabled unless explicitly
turned on.

However, there is currently no way to indicate the default state for a
given logger that isn't mentioned explicitly in a detailed config -
they're all implicitly disabled (or enabled, if that option is passed
in as part of the config). Changing to a 3-tier system lets libraries
use logging for error messages without them being lost by the default
configuration process.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list