This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: logging: allow multiple entries in qualname config
Type: Stage:
Components: Versions: Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: cmcqueen1975, dsuch, techtonik, vinay.sajip
Priority: normal Keywords:

Created on 2011-02-05 14:44 by techtonik, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (8)
msg127992 - (view) Author: anatoly techtonik (techtonik) Date: 2011-02-05 14:44
When configuration is specified in external file, qualname attribute should allow several values. Maybe comma separated.
msg128105 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-02-07 09:10
There's no particularly good use case for this. Plus, going forwards, dictionary-based configuration should be used (as it supports more logging features).
msg128149 - (view) Author: anatoly techtonik (techtonik) Date: 2011-02-07 18:55
Where is this configuration?
msg128164 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-02-08 00:53
See PEP 391. Documentation is at

http://docs.python.org/library/logging.html#configuration

as you might expect.
msg128166 - (view) Author: anatoly techtonik (techtonik) Date: 2011-02-08 08:08
And how do you intend to parse the dictionary stored in external file? Evaluating this script is unsafe.
msg128169 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2011-02-08 10:38
The logging package will not parse any external file to get a dictionary. It's up to the application developer to provide a dictionary which will be used for configuration, so there's no security issue in the stdlib.
msg220939 - (view) Author: Dariusz Suchojad (dsuch) Date: 2014-06-18 14:30
Hello friends,

@vinay.sajip - the use case for this feature is actually something I come across fairly often.

In an application I have dozens and hundreds of logger instances. However, they all fall into one of several loggers.

Most of the instances are obtained through a module-wide logger = getLogger(__name__).

Now I have a feature in the application split over a couple of modules, in different namespaces:

zato.common.scheduler
zato.server.scheduler

They are independent yet related and it would be most convenient if I could list both in qualname - they really should share the logging configuration, at no point they should have separate handlers, logging formats, anything.

As an aside, regarding dict configuration - I know you made the comment in 2011 so it may not represent your current opinion but please keep in mind that logging config is something that on production is updated by administrators, i.e. whatever the latest trends in software development are, they aren't necessarily programmers.

People I work with have no problems with customizing ini-like files but Python dicts are an entirely different story, they are simply afraid of doing it - a missing apostrophe may mean a couple of hours wasted, for instance.
msg220953 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-06-18 20:30
> they really should share the logging configuration

Well, that's easy enough to do - although there would be some duplication in the .ini file, it is not especially onerous. While I well understand the benefits of DRY, I still don't believe this is a very common use case, and there are other ways of doing this: for example, using a logger called zato.scheduler from both scheduler modules. I know that __name__ for naming loggers is a good approach in almost all cases, it's not absolutely mandatory. What I don't want to do is to keep adding functionality (which I will then have to maintain) to an older mechanism when a newer and better one is available. And using dictConfig() doesn't have to mean users/administrators editing Python source code by hand - for example, YAML could be used, or JSON. Or, use .ini but parse the file in your code and build a dict to pass to dictConfig(). Then you can use any schema you want, plus support things like Filters which fileConfig() doesn't do.
History
Date User Action Args
2022-04-11 14:57:12adminsetgithub: 55338
2017-07-25 03:44:21cmcqueen1975setnosy: + cmcqueen1975
2014-06-18 20:30:40vinay.sajipsetmessages: + msg220953
2014-06-18 14:30:18dsuchsetnosy: + dsuch
messages: + msg220939
2011-02-08 10:38:11vinay.sajipsettype: security ->
messages: + msg128169
2011-02-08 08:08:21techtoniksettype: security
2011-02-08 08:08:02techtoniksetmessages: + msg128166
2011-02-08 00:53:00vinay.sajipsetmessages: + msg128164
2011-02-07 18:55:18techtoniksetmessages: + msg128149
2011-02-07 09:10:28vinay.sajipsetassignee: vinay.sajip
2011-02-07 09:10:09vinay.sajipsetstatus: open -> closed

nosy: + vinay.sajip
messages: + msg128105

resolution: wont fix
2011-02-05 14:44:42techtonikcreate