Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging.config.dictConfig with disable_existing_loggers set, also disables loggers in configuration #90195

Closed
vladmihaisima mannequin opened this issue Dec 10, 2021 · 1 comment

Comments

@vladmihaisima
Copy link
Mannequin

vladmihaisima mannequin commented Dec 10, 2021

BPO 46037
Nosy @vladmihaisima
Files
  • bug.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-12-10.15:58:08.308>
    labels = ['3.8', '3.9', '3.10']
    title = 'logging.config.dictConfig with disable_existing_loggers set, also disables loggers in configuration'
    updated_at = <Date 2021-12-10.15:58:08.308>
    user = 'https://github.com/vladmihaisima'

    bugs.python.org fields:

    activity = <Date 2021-12-10.15:58:08.308>
    actor = 'vladmihaisima'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = []
    creation = <Date 2021-12-10.15:58:08.308>
    creator = 'vladmihaisima'
    dependencies = []
    files = ['50486']
    hgrepos = []
    issue_num = 46037
    keywords = []
    message_count = 1.0
    messages = ['408216']
    nosy_count = 1.0
    nosy_names = ['vladmihaisima']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46037'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @vladmihaisima
    Copy link
    Mannequin Author

    vladmihaisima mannequin commented Dec 10, 2021

    When invoking logging.config.dictConfig - if a logger was previously disabled (for example by a call to "logging.config.dictConfig({'version': 1})") - the loggers specified in the dictionary will not be enabled.

    Documentation at https://docs.python.org/3/library/logging.config.html specifies for disable_existing_loggers that "... behaviour is to disable any existing non-root loggers unless they or their ancestors are explicitly named in the logging configuration.". There is no explicit mention for what happens when a logger exists and is already disabled. I would have assumed that if present it will be enabled, but that does not seem to be the case.

    So I think that if a logger is disabled invoking dictConfig cannot re-enable it.

    See attached code for a reproducible case.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    vsajip added a commit to vsajip/cpython that referenced this issue Sep 3, 2022
    vsajip added a commit to vsajip/cpython that referenced this issue Sep 3, 2022
    vsajip added a commit to vsajip/cpython that referenced this issue Sep 3, 2022
    @vsajip vsajip closed this as completed Sep 3, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Status: Done
    Development

    No branches or pull requests

    1 participant