diff --git a/library/think/log/driver/File.php b/library/think/log/driver/File.php index 98f117af..37d2ca8d 100644 --- a/library/think/log/driver/File.php +++ b/library/think/log/driver/File.php @@ -20,10 +20,10 @@ class File { protected $config = [ 'time_format' => ' c ', + 'single' => false, 'file_size' => 2097152, 'path' => LOG_PATH, 'apart_level' => [], - 'single' => false, ]; protected $writed = []; @@ -84,7 +84,7 @@ class File protected function write($message, $destination, $apart = false) { //检测日志文件大小,超过配置大小则备份日志文件重新生成 - if (!$this->config['single'] && is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { + if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { rename($destination, dirname($destination) . DS . time() . '-' . basename($destination)); $this->writed[$destination] = false; }