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
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 2010-02-07 20:23 by vinay.sajip. 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?


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
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:

"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.
Date User Action Args
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