469,643 Members | 1,514 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Multiple calls to logging.config.fileConfig

Hi,

our applications can have plugins as subpackages and I'd like to allow
them to use their own logger as well as it's configuration. I thought
that best way will be their own configuration file passed to
fileConfig.

However, I run into problems...

1) It seems that I cannot refer to something from previously loaded
files, i.e. I'd like application config file to specify formatters and
handlers and plugins only referring them.

2) I'm not sure about "appending" loggers; if I specify
[loggers]
keys: web

and then
[loggers]
keys: syncml

Will web not be overwritten?

3) Finally, I run into "root" problem. In second call, if I specify
root logger again:

[loggers]
keys: root,web

(...)

[logger_web]
level: WARNING
qualname: xxx.web
handlers: console

I'll get

Traceback (most recent call last):
File "/usr/lib/python2.4/logging/config.py", line 143, in fileConfig
llist.remove("root")
If I'll set only web as logger, I'll get standard NoSectionFound
exception.

Any idea how to fix this? It seems that I have to write custom parser
merging all files and config logging directly from code, but I'd like
to assure that it's the standard way...

Regards,

Almad

Oct 5 '06 #1
1 1830
logging.config.fileConfig() does not do incremental configuration - it
replaces the existing configuration with the configuration in the file
passed to fileConfig. While this might not be too useful for your
current needs, the present behaviour is by design...fileConfig is meant
to choose between one of a number of configurations (e.g. development,
test, production) and not for incremental configuration.

Regards,

Vinay Sajip

Oct 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Andreas Jung | last post: by
1 post views Thread by j vickroy | last post: by
1 post views Thread by Chris Curvey | last post: by
7 posts views Thread by flupke | last post: by
6 posts views Thread by Vyacheslav Maslov | last post: by
2 posts views Thread by andrew cooke | last post: by
3 posts views Thread by Lowell Alleman | last post: by
4 posts views Thread by Matthew Wilson | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.