homepage

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.basicConfig should raise warning/exception on second call
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 3.1, Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: tocomo, vinay.sajip
Priority: normal Keywords:

Created on 2010年02月07日 14:51 by tocomo, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Messages (2)
msg99003 - (view) Author: Tobias (tocomo) Date: 2010年02月07日 14:51
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
msg99014 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2010年02月07日 20:23
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.
History
Date User Action Args
2022年04月11日 14:56:57adminsetgithub: 52122
2010年02月07日 20:23:14vinay.sajipsetstatus: open -> closed
resolution: not a bug
messages: + msg99014
2010年02月07日 16:59:24brian.curtinsetversions: + Python 3.1, - Python 2.5
nosy: + vinay.sajip

priority: normal
components: + Library (Lib), - 2to3 (2.x to 3.x conversion tool)
stage: test needed
2010年02月07日 14:51:42tocomocreate

AltStyle によって変換されたページ (->オリジナル) /