Better CFileLogRoute performance

This commit is contained in:
Alexander Makarov
2013-01-28 19:10:22 +01:00
parent cf1c20c38f
commit df7e370e23
2 changed files with 4 additions and 1 deletions

View File

@@ -140,8 +140,10 @@ class CFileLogRoute extends CLogRoute
@flock($fp,LOCK_EX);
if(@filesize($logFile)>$this->getMaxFileSize()*1024)
$this->rotateFiles();
$buffer='';
foreach($logs as $log)
@fwrite($fp,$this->formatLogMessage($log[0],$log[1],$log[2],$log[3]));
$buffer.=$this->formatLogMessage($log[0],$log[1],$log[2],$log[3]);
@fwrite($fp,$buffer);
@flock($fp,LOCK_UN);
@fclose($fp);
}