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.basicConfig should raise warning/exception on second call #52122

Closed
tocomo mannequin opened this issue Feb 7, 2010 · 2 comments
Closed

logging.basicConfig should raise warning/exception on second call #52122

tocomo mannequin opened this issue Feb 7, 2010 · 2 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@tocomo
Copy link
Mannequin

tocomo mannequin commented Feb 7, 2010

BPO 7874
Nosy @vsajip

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 2010-02-07.20:23:14.693>
created_at = <Date 2010-02-07.14:51:42.765>
labels = ['invalid', 'type-bug', 'library']
title = 'logging.basicConfig should raise warning/exception on second call'
updated_at = <Date 2010-02-07.20:23:14.691>
user = 'https://bugs.python.org/tocomo'

bugs.python.org fields:

activity = <Date 2010-02-07.20:23:14.691>
actor = 'vinay.sajip'
assignee = 'none'
closed = True
closed_date = <Date 2010-02-07.20:23:14.693>
closer = 'vinay.sajip'
components = ['Library (Lib)']
creation = <Date 2010-02-07.14:51:42.765>
creator = 'tocomo'
dependencies = []
files = []
hgrepos = []
issue_num = 7874
keywords = []
message_count = 2.0
messages = ['99003', '99014']
nosy_count = 2.0
nosy_names = ['vinay.sajip', 'tocomo']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'test needed'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue7874'
versions = ['Python 2.6', 'Python 3.1']

@tocomo
Copy link
Mannequin Author

tocomo mannequin commented Feb 7, 2010

logging.basicConfig should raise warning/eception on second call. Why?

logging.basicConfig(filename="/tmp/works.log")
logging.basicConfig(filename="/tmp/worksnot.log")

what do you think does happen? Right - logging goes to "/tmp/worksnot.log". But does not behave that way. The secound call does nothing. Simply bad coding style, an if without an else.

kind regards
Tobias

@tocomo tocomo mannequin added topic-2to3 type-bug An unexpected behavior, bug, or error labels Feb 7, 2010
@briancurtin briancurtin added stdlib Python modules in the Lib dir and removed topic-2to3 labels Feb 7, 2010
@vsajip
Copy link
Member

vsajip commented Feb 7, 2010

The fact that the second call will do nothing is specifically documented:

http://docs.python.org/dev/library/logging.html#logging.basicConfig

"This function does nothing if the root logger already has handlers configured for it."

This behaviour is by design, and not an accident caused by "bad coding style". Please check the documentation before posting issues which are not real issues. Thanks.

@vsajip vsajip closed this as completed Feb 7, 2010
@vsajip vsajip added the invalid label Feb 7, 2010
@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
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants