diff --git a/library/think/App.php b/library/think/App.php index e188223f..136d6930 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -79,9 +79,6 @@ class App Session::init($config['session']); } - // 日志初始化 - Log::init($config['log']); - if (empty(self::$dispatch['type'])) { // 未指定调度类型 则进行URL路由检测 self::route($config); diff --git a/library/think/Log.php b/library/think/Log.php index 6c62b871..aaecfbf2 100644 --- a/library/think/Log.php +++ b/library/think/Log.php @@ -80,6 +80,9 @@ class Log */ public static function save() { + if (is_null(self::$driver)) { + self::init(Config::get('log')); + } self::$driver->save(self::$log); } @@ -99,6 +102,9 @@ class Log // 监听log_write APP_HOOK && Hook::listen('log_write', $log); + if (is_null(self::$driver)) { + self::init(Config::get('log')); + } // 写入日志 self::$driver->save($log); }