- 新增 changeLogFile 方法用于切换日志文件 - 使用 Cron 注解设置定时任务执行时间 - 日志文件按日期命名存储在 runtime 目录下
@@ -34,4 +34,10 @@ class SystemCron
$this->cache->set('crontab_list', $crontabList);
$this->isStart = true;
}
+
+ #[Cron('1 0 0 * * *', 'system.cron.change_log_file')]
+ public function changeLogFile(): void
+ {
+ Worker::$logFile = root_path('runtime') . 'crontab_' . date('Ymd') . '.log';
+ }