Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 14, 2021

Conversation

vsajip
Copy link
Member

@vsajip vsajip commented Dec 13, 2021

rotator.namer = lambda name: name.replace('.log', '') + '.log'
for t in times:
files.append('%s.%s.log' % (prefix, t))
# Open empty files
Copy link
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
Member Author

Choose a reason for hiding this comment

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

Will do.

Lib/logging/handlers.py Show resolved Hide resolved
# 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
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
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
Copy link
Member Author

vsajip commented Dec 14, 2021

Thanks for the review.

@vsajip
Copy link
Member Author

vsajip commented Dec 14, 2021

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 added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Dec 14, 2021
@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
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

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

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

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Dec 14, 2021
vsajip added a commit that referenced this pull request Dec 14, 2021
…og file… (GH-30093) (GH-30094)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
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.

None yet

5 participants