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.

Title: logging.config.fileConfig attempts to write to file even when none configured
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: esesek, vinay.sajip
Priority: normal Keywords:

Created on 2014-09-19 21:06 by esesek, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
pixcli_template.ini esesek, 2014-09-19 21:06
Messages (2)
msg227122 - (view) Author: Ed Sesek (esesek) Date: 2014-09-19 21:06
See the attached config file.  logging.config.fileConfig() is attempting to write to the file specified in the file_handler section even though that handler is not configured for use in this config.  If its going to write to the file, it should only do so if the file is configured to be used.  In the case where it cannot write to the file it throws an exception with a blank message.
msg227205 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2014-09-21 08:03
I don't propose to make any changes to `fileConfig()`, for the following reasons:

1. It's not a bug, because there is no requirement to do what you suggest. You could (a) either not mention the handler in the config if you aren't going to use it, (b) use a delay parameter so the file opening is deferred until it's first needed, or (c) specify a file location which is accessible to the running process.

2. While it is not deprecated, the fileConfig() API has been supplanted by the dictConfig() API and is not receiving any functional changes. For the specific case you mention, dictConfig() would behave similarly to fileConfig(), and this wouldn't be a bug either: please use an approach such as those suggested in my earlier point to overcome your problem.
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66637
2014-09-21 08:03:33vinay.sajipsetstatus: open -> closed
type: behavior -> enhancement
resolution: not a bug
messages: + msg227205
2014-09-19 22:55:24berker.peksagsetnosy: + vinay.sajip
2014-09-19 21:06:21esesekcreate