Skip to content

bpo-46063: Improve algorithm for computing which rolled-over log file… (GH-30093)#30093

Merged
vsajip merged 2 commits into
python:mainfrom
vsajip:fix-46063
Dec 14, 2021
Merged

bpo-46063: Improve algorithm for computing which rolled-over log file… (GH-30093)#30093
vsajip merged 2 commits into
python:mainfrom
vsajip:fix-46063

Conversation

@vsajip

@vsajip vsajip commented Dec 13, 2021

Copy link
Copy Markdown
Member

Comment thread Lib/test/test_logging.py Outdated
rotator.namer = lambda name: name.replace('.log', '') + '.log'
for t in times:
files.append('%s.%s.log' % (prefix, t))
# Open empty files

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Open empty files
# Create empty files

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

Comment thread Lib/logging/handlers.py
Comment thread Lib/logging/handlers.py Outdated
# Our files could be just about anything after custom naming, but
# likely candidates are of the form
# foo.log.DATETIME_SUFFIX or foo.DATETIME_SUFFIX.log
if not fileName.startswith(baseName) and fileName.endswith(e) and len(fileName) > (plen + 1) and not fileName[plen+1].isdigit():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very long line, I don't know if you follow PEP 8 here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll shorten it by wrapping over successive lines.

@vsajip

vsajip commented Dec 14, 2021

Copy link
Copy Markdown
Member Author

Thanks for the review.

@vsajip

vsajip commented Dec 14, 2021

Copy link
Copy Markdown
Member Author

I’m not sure you documented the default naming scheme

Yes, that's done (briefly, but I think sufficiently) in the API documentation for RotatingHandler and TimedRotatingFileHandler.

@vsajip vsajip changed the title bpo-46063: Improve algorithm for computing which rolled-over log file… bpo-46063: Improve algorithm for computing which rolled-over log file… (GH-30093) Dec 14, 2021
@vsajip
vsajip merged commit cb589d1 into python:main Dec 14, 2021
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @vsajip for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

@vsajip
vsajip deleted the fix-46063 branch December 14, 2021 00:53
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 14, 2021
pythonGH-30093)

(cherry picked from commit cb589d1)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
@bedevere-bot

Copy link
Copy Markdown

GH-30094 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Dec 14, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 14, 2021
pythonGH-30093)

(cherry picked from commit cb589d1)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
@bedevere-bot

Copy link
Copy Markdown

GH-30095 is a backport of this pull request to the 3.9 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants