Issue 7874: logging.basicConfig should raise warning/exception on second call (original) (raw)

Issue7874

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:57 admin set github: 52122
2010-02-07 20:23:14 vinay.sajip set status: open -> closedresolution: not a bugmessages: +
2010-02-07 16:59:24 brian.curtin set versions: + Python 3.1, - Python 2.5nosy: + vinay.sajippriority: normalcomponents: + Library (Lib), - 2to3 (2.x to 3.x conversion tool)stage: test needed
2010-02-07 14:51:42 tocomo create