You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Under Windows, logs are not rotating properly when they exceed maxFileSize. The file is locked (by the same process). see http://www.php.net/manual/en/function.rename.php, comment by "Martin Pelletier" which says "rename() is working on Linux/UNIX but not working on Windows on a directory containing a file formerly opened within the same script. The problem persists even after properly closing the file and flushing the buffer."
To work around this problem, I started using rotateByCopy=true. However now it's rotating the file TWICE.
start with only application.log (no .1, .2, etc.)
run the app, cause something to be written to the log
first pass thru processLogs() renames application.log => application.log.1
after log is rotated, collectLogs() is called again to handle the current log entry
when it gets to if(@filesize($logFile)>$this->getMaxFileSize()*1024), the filesize is CACHED, which causes rotateFiles() to be called a 2nd time, moving the .1 file to .2
To fix this problem, I added the following statement in CFileLogRoute.rotateFiles() at the very bottom of if(is_file($file)) {... @clearstatcache(); }
this fixes the problem. see next comment for patch
The text was updated successfully, but these errors were encountered:
Win7Home; PHP 5.5.10; Apache 2.4.7; Yii 1.1.14
Under Windows, logs are not rotating properly when they exceed maxFileSize. The file is locked (by the same process). see http://www.php.net/manual/en/function.rename.php, comment by "Martin Pelletier" which says "rename() is working on Linux/UNIX but not working on Windows on a directory containing a file formerly opened within the same script. The problem persists even after properly closing the file and flushing the buffer."
To work around this problem, I started using rotateByCopy=true. However now it's rotating the file TWICE.
To fix this problem, I added the following statement in CFileLogRoute.rotateFiles() at the very bottom of if(is_file($file)) {... @clearstatcache(); }
this fixes the problem. see next comment for patch
The text was updated successfully, but these errors were encountered: