A simpler logging configuration file format?

geoff.bache at gmail.com geoff.bache at gmail.com
Fri Jun 5 16:07:26 EDT 2009


Hi all,

I wonder if there are others out there who like me have tried to use
the logging module's configuration file and found it bloated and over-
complex for simple usage (i.e. a collection of loggers writing to
files)

At the moment, if I want to add a new logger "foo" writing to its own
file "foo" to my config file, I have to repeat the name 7(!) times,
editing 3 different sections in the process:

1) Add "foo" to [loggers] and [handlers]. (These seem completely
pointless and were apparently added in anticipation of new
functionality that never happened).

2) Create the section
[logger_foo]
handler:foo
qualname:foo
level:INFO

3) Create the section
[handler_foo]
class: FileHandler
args:("foo", "a")

Wondering how it got like this, I found this blog from soon after it
was released in 2004:

http://www.mechanicalcat.net/richard/log/Python/Simple_usage_of_Python_s_logging_module

Some of the verdicts are "full of dead chickens and error prone",
"horribly complicated" , "over-engineered". So along comes the
"basicConfig" method in 2005 which is supposed to address thes
concerns. But this can only be applied globally, not even to
individual loggers, so is only helpful for extremely basic usage
(everything to one target) as far as I can see. The config file is
still much as it was then.

I'd really like to see the concept extended to encompass multiple
loggers and the config file. Allowing Logger.basicConfig should be
trivial. Writing a configuration format which took a section and
passed all the options in it to basicConfig would in my view lead to a
much friendlier syntax for normal usage.



More information about the Python-list mailing list