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 docs don't address the creation of multiple loggers when a hierarchy is provided #83721

Closed
flipdazed mannequin opened this issue Feb 3, 2020 · 2 comments
Closed
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@flipdazed
Copy link
Mannequin

flipdazed mannequin commented Feb 3, 2020

BPO 39540
Nosy @vsajip, @flipdazed

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 = <Date 2020-02-19.19:56:30.420>
created_at = <Date 2020-02-03.12:29:54.046>
labels = ['3.7', '3.8', '3.9', 'type-feature', 'invalid', 'docs']
title = "Logging docs don't address the creation of multiple loggers when a hierarchy is provided"
updated_at = <Date 2020-02-19.19:56:30.420>
user = 'https://github.com/flipdazed'

bugs.python.org fields:

activity = <Date 2020-02-19.19:56:30.420>
actor = 'vinay.sajip'
assignee = 'docs@python'
closed = True
closed_date = <Date 2020-02-19.19:56:30.420>
closer = 'vinay.sajip'
components = ['Documentation']
creation = <Date 2020-02-03.12:29:54.046>
creator = 'flipdazed'
dependencies = []
files = []
hgrepos = []
issue_num = 39540
keywords = []
message_count = 2.0
messages = ['361287', '361337']
nosy_count = 3.0
nosy_names = ['vinay.sajip', 'docs@python', 'flipdazed']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue39540'
versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9']

@flipdazed
Copy link
Mannequin Author

flipdazed mannequin commented Feb 3, 2020

If logger_name is a hierarchy format (e.g. logger_name = 'parent.child') and the logger name 'parent' has not been created, the function call logging.getLogger(logger_name) will create all loggers in the hierarchy (in this instance two loggers, 'parent' and 'parent.child' will be created)

This is not documented anywhere in the logging documentation. Suggest that this is detailed under logging.getLogger

More info...
https://stackoverflow.com/q/59990300/4013571

@flipdazed flipdazed mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Feb 3, 2020
@flipdazed flipdazed mannequin assigned docspython Feb 3, 2020
@flipdazed flipdazed mannequin added docs Documentation in the Doc dir 3.8 only security fixes type-feature A feature request or enhancement 3.9 only security fixes labels Feb 3, 2020
@flipdazed flipdazed mannequin assigned docspython Feb 3, 2020
@flipdazed flipdazed mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Feb 3, 2020
@vsajip
Copy link
Member

vsajip commented Feb 4, 2020

That's an internal detail. In fact loggers aren't created for all loggers in the hierarchy - PlaceHolder objects are created internally for hierarchy ancestors, and converted to loggers if needed. The printout from your linked Stack Overflow question shows this.

This is not documented because it's internal implementation detail. How the dotted-name hierarchy works is documented.

@vsajip vsajip closed this as completed Feb 19, 2020
@vsajip vsajip added the invalid label Feb 19, 2020
@vsajip vsajip closed this as completed Feb 19, 2020
@vsajip vsajip added the invalid label Feb 19, 2020
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant