Skip to content

Preserve modification time of rotated log files in FileRotator.#84

Open
terabytesoftw wants to merge 6 commits into
masterfrom
fix/preserve-rotated-log-mtime
Open

Preserve modification time of rotated log files in FileRotator.#84
terabytesoftw wants to merge 6 commits into
masterfrom
fix/preserve-rotated-log-mtime

Conversation

@terabytesoftw

Copy link
Copy Markdown
Member
Q A
Is bugfix? ✔️
New feature?
Breaks BC?

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.12%. Comparing base (d9b2c1e) to head (cf22a24).

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #84      +/-   ##
============================================
+ Coverage     86.73%   87.12%   +0.39%     
- Complexity       36       38       +2     
============================================
  Files             2        2              
  Lines            98      101       +3     
============================================
+ Hits             85       88       +3     
  Misses           13       13              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@terabytesoftw terabytesoftw requested a review from a team June 9, 2026 10:24
@terabytesoftw terabytesoftw added the status:code review The pull request needs review. label Jun 9, 2026
@samdark samdark requested a review from Copilot June 9, 2026 10:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes log rotation behavior so that rotated log files keep the original file’s modification timestamp, including when rotation uses gzip compression.

Changes:

  • Update FileRotator::rotate() to capture the source file mtime and apply it to the rotated file via touch().
  • Add a PHPUnit test ensuring rotated files preserve modification time for both compressed and uncompressed rotation.
  • Document the bugfix in CHANGELOG.md.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/FileRotator.php Captures source filemtime() and applies it to the rotated (and possibly compressed) destination file.
tests/FileRotatorTest.php Adds regression test verifying mtime preservation for both compression modes.
CHANGELOG.md Adds an entry describing the bugfix under the next release.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/FileRotator.php Outdated
Comment thread src/FileRotator.php Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:code review The pull request needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants