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.

Author maggyero
Recipients maggyero
Date 2018-06-27.09:29:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1530091756.08.0.56676864532.issue33978@psf.upfronthosting.co.za>
In-reply-to
Content
Calling logging.config.dictConfig several times with a file handler in the same Python process leaks resources.

INPUT:

$ python3 -Wall <<EOF
import logging.config

config = {
    "version": 1,
    "handlers": {
        "file": {
            "class": "logging.FileHandler",
            "filename": "test.log"
        }
    },
    "root": {
        "handlers": ["file"]
    }
}
logging.config.dictConfig(config)
logging.config.dictConfig(config)
EOF

OUTPUT:

/usr/lib/python3.6/logging/config.py:789: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/maggyero/test.log' mode='a' encoding='UTF-8'>
  self.common_logger_config(root, config, incremental)
History
Date User Action Args
2018-06-27 09:29:16maggyerosetrecipients: + maggyero
2018-06-27 09:29:16maggyerosetmessageid: <1530091756.08.0.56676864532.issue33978@psf.upfronthosting.co.za>
2018-06-27 09:29:16maggyerolinkissue33978 messages
2018-06-27 09:29:15maggyerocreate