[stdlib-sig] logging

Paul Moore p.f.moore at gmail.com
Fri Sep 18 17:21:29 CEST 2009


2009/9/18 Jesse Noller <jnoller at gmail.com>:
> I've kept my mouth shut (well, on this subject) simply due to the fact
> I tend to feel API design is a bit of a "smell" thing. First off;
> thank you for the package.
[...]
> Perhaps that's a good place to start - higher level
> functions/methods/etc to "scale down" loggings perceived complexity? I
> know I'm trying to do bits of that for multiprocessing.

Basically, exactly what Jesse said applies with me - except that I
don't use the logging module intensively, and when I do use it the
lack of a simple approach makes it a struggle (nagging "why don't I
just use print statements" questions in the back of my mind :-))

If I try to recall my last experience, things that struck me as "too hard" were:

- logging.getLogger().warning(...) is irritatingly verbose ("feels
like Java"). Hmm, looks like I missed the module-level warning()
function and its cousins - don't know how I managed that! That's
basically my mistake (I can't even really claim that the documentation
is hard to find, looks like I just missed it). It might be nice if the
module-level functions had a logger='whatever' argument to ease the
change from "simple" requirements (root logger only) to more complex
ones (multiple loggers), but that's hardly critical.

- The file configuration seems very complex, for simple uses. I looked
at using it, but ultimately rolled my own, because I only wanted a few
simple options (which, no surprise, grew as time went on :-)).
Currently my application config consists of

[Log]
level: ERROR
file: {APPDIR}\{APP}.log
maxsize: 1M

log level, file to log to (with a couple of simple templating
parameters and special cases of "stdout" and "stderr") and a max size
(if set, use a rotating file handler).

Of course, writing a simpler version of logging.config.fileConfig can
be done as a 3rd party addition, so it's not fundamental to the
logging module.

Oh, and finally I *hate* Java-style camelCase but that's purely a
preference thing, and it's not going to change for compatibility
reasons, so let's ignore that.

Anyway, ultimately have no significant issues with the logging module.
Maybe it doesn't make the simple cases as simple as I'd like, but it
gives me all the power I'm ever likely to need, and then some. So
thanks for all your work on it!

Paul


More information about the stdlib-sig mailing list