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

Vinay Sajip vinay_sajip at yahoo.co.uk
Sat Dec 11 09:52:45 CET 2010

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

>     Yep, agree.  But sadly, for each point, there may be multiple
>     options (your StreamHandler, but I'd want a FileHandler; your
>     separation of messages by level, my wanting them combined; etc.)

That's partly why logging hasn't made much effort in the "default" department:
everyone wants something different.

>     Your comment about basicConfig setting the level on the root logger,
>     but not on the default handler making it useless is opaque to me,

I think he just means that he can't use basicConfig because it just sets the
root logger's level to whatever's passed in, but what he actually wants to set
are two different levels: INFO on the logger, WARNING on the stderr handler.
On top of that, he wants to have a stdout handler which only outputs INFO
events, and to get that effect he has to add the filter to the stdout handler
(otherwise it would output INFO + anything at a higher level, too).

>     but is there perhaps room for another basic setup API that could get
>     the setup code down to a line or two in simple cases?  Maybe 3
>     parameters:
>     Would that be a useful set of functionality to bundle?  And could it
>     be extended, when the user wants more power, or would it have to be
>     replaced, because it gets in the way of the user that wants more
>     power?

It's possible that perhaps there could be some 'canned configs', as I've
mentioned in another post on this thread. Some more thinking needs to be done
around this area.


Vinay Sajip

More information about the Python-Dev mailing list