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

Paul Moore p.f.moore at gmail.com
Sun Dec 12 23:26:10 CET 2010

On 10 December 2010 20:57, Glenn Linderman <v+python at g.nevcal.com> wrote:
> On 12/10/2010 12:49 PM, Antoine Pitrou wrote:
> And yet, I have helped many people who were baffled by exactly what
>> Bill observed: logging.info() didn't do anything. Maybe the default
>> should be INFO?
> Funny, because displaying only errors and silencing other messages is
> exactly what I expected logging to do by default.
> So we are slowly learning the things that should be on the first couple
> pages of the logging docs...
> 1) simple example for one file programs, include an example of specifying
> output severity threshold.  I'm with Antoine here on my expectations.
> 2) example for multi-module, showing how a single logging destination causes
> logging to happen in all modules, at the same level (if that is the case,
> which I hope it is).
> 3) Maybe a small discussion of log formatting should be next?  So the user
> realizes he shouldn't do the message formatting himself?
> 4) Then rotating logs for long-running programs.

The thing *I* hit very early was wanting to add a command lime option
to my script to set the logging level. I'd have liked to be able to
add --log=INFO/DEBUG/... but to do that I seem to need to write my own
mapping between level names and numbers. A simple example of how to
tie command line options to logging config would be a great addition
to the documentation.


More information about the Python-Dev mailing list