[Python-Dev] Proposed change to logging

Guido van Rossum guido at python.org
Wed Aug 25 17:32:42 CEST 2004


> > > print >> err, "My logging message with %s" % "arguments"
> > > print >> dbg, "A message at %s level" % "debug"
> > 
> > Is this really a useful improvement?  It seems to
> > save a few keystrokes at most.  TOOWTDI etc.
> 
> My personal vote would be +0, I posted the suggestion
> only because some people have raised concerns that the
> logging module is hard to use, and using "print" might
> seem easier for newbies or casual users. Before
> checking in, I want to see if I can remove that
> implementation wart I mentioned. I feel the solution
> Barry suggested is not as elegant as I'd like to have.

But the complexity of the logging module doesn't stem from the message
logging interface, which is actually very simple.

It comes from the configuration interface, and from the complexity of
having separate concepts of loggers, handlers, and formatters, and of
the unintuitive filter rules (often setting the logger's level doesn't
work because the handler's level is still wrong, or the other way
around).

All of that complexity was inherited from Java, BTW (I've run in
exactly those same problems at work with the Java logging package).

I'm -0.5 on the file interface -- passing loggers around actually
becomes more complicated because you have to pass around separate info
and debug streams (etc.).

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list