$mustRotate
in RotatingFileHandler
not resetting properly
#1905
Labels
$mustRotate
in RotatingFileHandler
not resetting properly
#1905
Our team is using Monolog version 2 and has encountered an issue where the
$mustRotate
attribute of theRotatingFileHandler
is only set tofalse
if all unrelated conditions in therotate
method are satisfied:monolog/src/Monolog/Handler/RotatingFileHandler.php
Lines 128 to 171 in 884aa47
This issue interacts with Octane, leading to a serious problem where logs cannot rotate to a new file. The problem arises because the
reset
method is called on everyRequestReceived
:https://github.com/laravel/octane/blob/2.x/src/Listeners/FlushMonologState.php
When a
RotatingFileHandler
instance is reset withtrue === $this->mustRotate
, the$this->url
and$this->nextRotation
attributes are updated by callingrotate
:monolog/src/Monolog/Handler/RotatingFileHandler.php
Lines 133 to 135 in 884aa47
As a result, the
write
method cannot write to the new stream because$this->close()
is never reached. This occurs because$this->nextRotation
is already updated during the call toreset
:monolog/src/Monolog/Handler/RotatingFileHandler.php
Lines 113 to 126 in 884aa47
The text was updated successfully, but these errors were encountered: