Explorar o código

fix(cron): 调整定时任务日志文件命名格式

- 修改日志文件名格式,使用下划线替代点号分隔日期与crontab- 更新统计文件命名,保持一致性- 保证日志文件按日期正确轮转命名
runphp hai 5 meses
pai
achega
05d5000e56
Modificáronse 2 ficheiros con 3 adicións e 3 borrados
  1. 2 2
      src/Command/CrontabCommand.php
  2. 1 1
      src/Cron/SystemCron.php

+ 2 - 2
src/Command/CrontabCommand.php

@@ -43,8 +43,8 @@ class CrontabCommand extends Command
                 parent::__construct($socketName, $socketContext);
                 self::$argv = $argv;
                 self::$pidFile = $app->getRootPath() . 'runtime/crontab.pid';
-                self::$logFile = $app->getRootPath() . 'runtime/log/' . date('Ymd') . '.crontab.log';
-                self::$statisticsFile = $app->getRootPath() . 'runtime/crontab.statistics.php';
+                self::$logFile = $app->getRootPath() . 'runtime/log/' . date('Ymd') . '_crontab.log';
+                self::$statisticsFile = $app->getRootPath() . 'runtime/crontab_statistics.php';
             }
 
             public function setOnWorkerStart(callable $worker): void

+ 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/log')  . date('Ymd') . '.crontab.log';
+        Worker::$logFile = root_path('runtime/log')  . date('Ymd') . '_crontab.log';
     }
 }