Răsfoiți Sursa

refactor(cron): 调整定时任务日志文件路径- 将 crontab 日志文件路径从 runtime 目录调整至 runtime/log 目录
- 统一日志文件命名格式为 Ymd.crontab.log- 确保日志文件按日期归档存储于 log 子目录中

runphp 5 luni în urmă
părinte
comite
e15bece986
2 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 1 1
      src/Command/CrontabCommand.php
  2. 1 1
      src/Cron/SystemCron.php

+ 1 - 1
src/Command/CrontabCommand.php

@@ -43,7 +43,7 @@ class CrontabCommand extends Command
                 parent::__construct($socketName, $socketContext);
                 self::$argv = $argv;
                 self::$pidFile = $app->getRootPath() . 'runtime/crontab.pid';
-                self::$logFile = $app->getRootPath() . 'runtime/crontab_' . date('Ymd') . '.log';
+                self::$logFile = $app->getRootPath() . 'runtime/log/' . date('Ymd') . '.crontab.log';
                 self::$statisticsFile = $app->getRootPath() . 'runtime/crontab.statistics.php';
             }
 

+ 1 - 1
src/Cron/SystemCron.php

@@ -38,6 +38,6 @@ class SystemCron
     #[Cron('1 0 0 * * *', 'system.cron.change_log_file')]
     public function changeLogFile(): void
     {
-        Worker::$logFile = root_path('runtime') . 'crontab_' . date('Ymd') . '.log';
+        Worker::$logFile = root_path('runtime/log')  . date('Ymd') . '.crontab.log';
     }
 }