diff --git a/System/Error/Logger.php b/System/Error/Logger.php index 85a5d5a3..f688c163 100644 --- a/System/Error/Logger.php +++ b/System/Error/Logger.php @@ -168,12 +168,13 @@ class Logger extends Component $fileName = storage('server-' . $to_day . '.log', $dirName = 'log/' . ($method ?? 'app')); if (!isset($this->sources[$to_day][$fileName]) || !is_writable($this->sources[$to_day][$fileName])) { - if (!($this->sources[$to_day][$fileName] = fopen($fileName, 'rw'))) { - return; - } + $this->sources[$to_day][$fileName] = fopen($fileName, 'rw'); + } + try { + fwrite($this->sources[$to_day][$fileName], '[' . date('Y-m-d H:i:s') . ']:' . PHP_EOL . $messages . PHP_EOL); + } catch (Throwable $exception) { + $this->output($exception->getMessage()); } - fwrite($this->sources[$to_day][$fileName], '[' . date('Y-m-d H:i:s') . ']:' . PHP_EOL . $messages . PHP_EOL); - $this->clearHistoryFile($dirName); $this->clearPrevLog($to_day);