yiisoft/yii2

Preserve a log file's modification time on rotation

已关闭

#20,261 创建于 2024年10月1日

 (10 条评论) (2 个反应) (0 位负责人)PHP (6,784 个派生)batch import
help wantedstatus:ready for adoptiontype:enhancement

仓库指标

星标
 (14,302 个星标)
PR 合并指标
 (平均合并 2天 15小时) (30 天内合并 47 个 PR)

描述

What steps will reproduce the problem?

Use Yii's FileTarget enough to cause log file rotation.

What is the expected result?

FS modification time of each log file indicates the date-time when that log file was last written.

What do you get instead?

It indicates when the file was last copied in a rotation.

It is likely enough to add one line to the FileTarget::rotateByCopy() function

        @touch($newFile, filemtime($rotateFile));

贡献者指南