[Python-Dev] Using logging in the stdlib and its unit tests

Antoine Pitrou solipsis at pitrou.net
Wed Dec 8 10:41:45 CET 2010


On Wed, 8 Dec 2010 01:51:44 +0000 (UTC)
Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
>  
> > Adding a NullHandler isn't the right thing to do - the behaviour I
> > would want for any standard library logging that hasn't been
> > explicitly configured otherwise is to do what the root logger does
> > under basicConfig(): debug() and info() get suppressed, warn(),
> > error(), critical() and exception() go to stderr. It seems to me like
> > that would be more useful default behaviour in general than emitting a
> > warning about not finding a handler.
> >
> > So my suggestion would be:
> > 1. In the absence of a "config" call, make the "no handler" path in
> > loggers emit messages *as if* basicConfig() has been called (without
> > actually calling it)
> > 2. Remove the implicit calls to basicConfig() from the module level
> > convenience function
> > 
> > How *feasible* that idea is to implement, I don't know.
> > 
> 
> What about "Special cases aren't special enough to break the rules."?

Well, it seems we are asking to remove the special cases, since we are
asking for the special case to become the norm.

Antoine.




More information about the Python-Dev mailing list