473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1998
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andreas Jung | last post by:
I am trying to write a custom logger with a custom handler: class MyHandler(StreamHandler): pass class Logger: def __init__(self): self._l = logging.getLogger('someident')...
1
by: j vickroy | last post by:
My system: MSW XP professional Python 2.3.3 logging package: 0.4.9.2 My problem: The log_test3.py script, provided with the logging package distribution, generates an unexpected message: No...
1
by: Chris Curvey | last post by:
Hi all, I've apparently tied myself up a bit using the logging package. In my project, I have a core set of model and controller classes that set up their logging using logging.fileConfig()....
7
by: flupke | last post by:
Hi, i'm getting errors with the log module concerning RotatingFileHandler. I'm using Python 2.4.3 on Windows XP SP2. This used to work in previous python versions but since i upgraded to 2.4.3...
6
by: Vyacheslav Maslov | last post by:
Hi all! I have many many many python unit test, which are used for testing some remote web service. The most important issue here is logging of test execution process and result. I strongly...
3
by: guybenron | last post by:
Hey, I have a sort of petty-neurotic question, I'm kinda pedantic and like to keep my log directories clean, and this thing is bothering me to the point of actually posting a question (couldn't...
2
by: andrew cooke | last post by:
Hi, I am seeing some odd behaviour with logging which would be explained if loggers that are not defined explicitly (but which are controlled via their ancestors) must be created after the...
3
by: Lowell Alleman | last post by:
Here is the situation: I wrote my own log handler class (derived from logging.Handler) and I want to be able to use it from a logging config file, that is, a config file loaded with the...
4
by: Matthew Wilson | last post by:
I'm working on a package that uses the standard library logging module along with a .cfg file. In my code, I use logging.config.fileConfig('/home/matt/mypackage/matt.cfg') to load in the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.