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.config does not allow disable_existing_loggers=True
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Grazfather x, chillydev, python-dev, vinay.sajip
Priority: normal Keywords: patch

Created on 2016-03-10 22:28 by Grazfather x, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Issue#26533.patch chillydev, 2016-03-15 04:40 Bug fix for issue #26533 review
Messages (6)
msg261526 - (view) Author: Grazfather x (Grazfather x) Date: 2016-03-10 22:28
logging.config.FileConfig has a kwarg 'disable_existing_loggers' that defaults to False, but when true will allow you to load a config and not disable all other existing loggers.

logging.config.listen uses FileConfig, but has no option to provide this keyword to it, which is a problem when a logger hierarchy is build using logger.getLogger(__name__) (which is recommended in the documentation).

Proposal: Add kwarg 'disable_existing_loggers' to logging.config.listen which is passed to fileConfig.
msg261798 - (view) Author: Patrick Egan (chillydev) * Date: 2016-03-15 04:40
Used proposed method to solve this bug and implemented the extra kwarg disable_existing_loggers to the listen() parameters.
msg270953 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2016-07-21 18:56
I think this is just a documentation issue. You can send a dictionary suitable for dictConfig() as JSON over the listen() socket. This is supported by 2.7 and 3.2+ - the documentation doesn't mention this, though.
msg270962 - (view) Author: Grazfather x (Grazfather x) Date: 2016-07-21 22:00
That's not really what this is about. This is about setting up the listener so that by default that setting is used.

In logging/config.py:

```python
def listen(port=DEFAULT_LOGGING_CONFIG_PORT, verify=None):
...
                            try:
                                fileConfig(file)
                            except Exception:
                                traceback.print_exc()
...

def fileConfig(fname, defaults=None, disable_existing_loggers=True):
...
```
msg270963 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2016-07-21 22:12
> That's not really what this is about.

As I see it, it's about the ability to configure disabling of existing loggers on reconfiguration via the listener. While it can't be done using fileConfig(), it *can* be done using dictConfig().
msg275779 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-11 12:16
New changeset 65a1abf4b432 by Vinay Sajip in branch '3.5':
Closed #26533: expanded on behaviour of logging.config.listen().
https://hg.python.org/cpython/rev/65a1abf4b432

New changeset abd744bf62fb by Vinay Sajip in branch 'default':
Closed #26533: Merged update from 3.5.
https://hg.python.org/cpython/rev/abd744bf62fb
History
Date User Action Args
2022-04-11 14:58:28adminsetgithub: 70720
2016-09-11 12:16:05python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg275779

resolution: fixed
stage: resolved
2016-07-21 22:12:37vinay.sajipsetmessages: + msg270963
2016-07-21 22:00:49Grazfather xsetmessages: + msg270962
2016-07-21 18:56:32vinay.sajipsetmessages: + msg270953
2016-03-15 04:40:04chillydevsetfiles: + Issue#26533.patch

nosy: + chillydev
messages: + msg261798

keywords: + patch
2016-03-11 00:33:16ned.deilysetnosy: + vinay.sajip
2016-03-10 22:28:46Grazfather xcreate