[GH-ISSUE #1945] RotatingFileHandler.php There may be bugs #836

Closed
opened 2026-03-04 03:01:14 +03:00 by kerem · 2 comments
Owner

Originally created by @song1024 on GitHub (Feb 7, 2025).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1945

Monolog version 1|2|3?
3.8.1

Write your bug report here.

RotatingFileHandler.php

if ($this->nextRotation <= $record->datetime) { ...

Is the condition written backwards?
The framework I am using uses this component, but the logs cannot be deleted. By tracing the source code and reverse modifying the conditions here, the logs were immediately deleted

Originally created by @song1024 on GitHub (Feb 7, 2025). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1945 Monolog version 1|2|3? 3.8.1 Write your bug report here. RotatingFileHandler.php if ($this->nextRotation <= $record->datetime) { ... Is the condition written backwards? The framework I am using uses this component, but the logs cannot be deleted. By tracing the source code and reverse modifying the conditions here, the logs were immediately deleted
kerem 2026-03-04 03:01:14 +03:00
  • closed this issue
  • added the
    Bug
    label
Author
Owner

@stof commented on GitHub (Feb 7, 2025):

This condition looks right to me: we trigger a rotation if the record date is after the time for which the next rotation is scheduled

<!-- gh-comment-id:2642698672 --> @stof commented on GitHub (Feb 7, 2025): This condition looks right to me: we trigger a rotation if the record date is after the time for which the next rotation is scheduled
Author
Owner

@song1024 commented on GitHub (Feb 7, 2025):

Thank you, it may be an internal error in my local framework.
It's not a monolog error.

<!-- gh-comment-id:2643293176 --> @song1024 commented on GitHub (Feb 7, 2025): Thank you, it may be an internal error in my local framework. It's not a monolog error.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#836
No description provided.