classification
Title: backupCount is not respected in TimedRotatingFileHandler when namer is specified
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: alexander.smirnoff, miss-islington, vinay.sajip
Priority: normal Keywords: patch

Created on 2021-07-27 22:37 by alexander.smirnoff, last changed 2021-07-30 16:22 by vinay.sajip. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 27475 merged vinay.sajip, 2021-07-30 10:47
PR 27486 merged miss-islington, 2021-07-30 15:56
PR 27487 merged miss-islington, 2021-07-30 15:56
Messages (6)
msg398326 - (view) Author: Alexander Smirnov (alexander.smirnoff) Date: 2021-07-27 22:37
after adding namer callable (like it is described in https://bugs.python.org/issue43344) to log handler configuration, it stopped removing old files

log_filename = os.path.join(log_dir, "application.log")
log_handler = logging.handlers.TimedRotatingFileHandler(log_filename, when='MIDNIGHT', interval=1, backupCount=7)

// after adding this line, old files are not deleted
log_handler.namer = lambda name: name.replace(".log", "") + ".log"
msg398537 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2021-07-30 11:48
New changeset 6ff890380971752299325bd28eab80ec936975cf by Vinay Sajip in branch 'main':
bpo-44753: Don't use logfile extension when determining old files to be deleted (GH-27475)
https://github.com/python/cpython/commit/6ff890380971752299325bd28eab80ec936975cf
msg398538 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2021-07-30 11:53
Should be fixed in main, leaving open until backports are done.
msg398568 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2021-07-30 16:20
New changeset 882e4761c63ae76d994b57bbcd7e5adbf2aa7b4f by Miss Islington (bot) in branch '3.9':
bpo-44753: Don't use logfile extension when determining old files to be deleted (GH-27475) (GH-27486)
https://github.com/python/cpython/commit/882e4761c63ae76d994b57bbcd7e5adbf2aa7b4f
msg398569 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2021-07-30 16:21
New changeset 6e6dc2517379289932c68fc986ee3994468374fc by Miss Islington (bot) in branch '3.10':
bpo-44753: Don't use logfile extension when determining old files to be deleted (GH-27475) (GH-27487)
https://github.com/python/cpython/commit/6e6dc2517379289932c68fc986ee3994468374fc
msg398570 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2021-07-30 16:22
Thanks for the bug report.
History
Date User Action Args
2021-07-30 16:22:12vinay.sajipsetstatus: open -> closed
resolution: fixed
messages: + msg398570

stage: patch review -> resolved
2021-07-30 16:21:03vinay.sajipsetmessages: + msg398569
2021-07-30 16:20:32vinay.sajipsetmessages: + msg398568
2021-07-30 15:56:42miss-islingtonsetpull_requests: + pull_request26003
2021-07-30 15:56:36miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request26002
2021-07-30 11:53:17vinay.sajipsetmessages: + msg398538
versions: + Python 3.9, Python 3.10, - Python 3.8
2021-07-30 11:48:58vinay.sajipsetmessages: + msg398537
2021-07-30 10:47:50vinay.sajipsetkeywords: + patch
stage: patch review
pull_requests: + pull_request25994
2021-07-29 14:03:48vinay.sajipsetnosy: + vinay.sajip
2021-07-27 22:37:54alexander.smirnoffcreate