update:优化定时任务日志记录
This commit is contained in:
parent
5fa20a4f28
commit
5223997031
@ -154,7 +154,7 @@ class Master
|
|||||||
}
|
}
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
// todo
|
// todo
|
||||||
echo $exception->getMessage();
|
echo sprintf('[%s]: ', date('Y-m-d H:i:s')) . $exception->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ trait CrontabLogSearch
|
|||||||
|
|
||||||
public function searchStatusAttr($query, $value, $data)
|
public function searchStatusAttr($query, $value, $data)
|
||||||
{
|
{
|
||||||
return $query->where('status', $value);
|
return $query->where('crontab_log.status', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function searchStartAtAttr($query, $value, $data)
|
public function searchStartAtAttr($query, $value, $data)
|
||||||
|
@ -11,5 +11,5 @@
|
|||||||
"aliases": [],
|
"aliases": [],
|
||||||
"files": [],
|
"files": [],
|
||||||
"requires": [],
|
"requires": [],
|
||||||
"enable": false
|
"enable": true
|
||||||
}
|
}
|
@ -50,9 +50,9 @@ abstract class CatchCronTask
|
|||||||
return true;
|
return true;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->dealWithException($e);
|
$this->dealWithException($e);
|
||||||
echo 'File:' . $e->getFile() . ', Lines: '. $e->getLine() .'行,Exception Message: ' . $e->getMessage() . PHP_EOL;
|
echo sprintf('[%s]: ', date('Y-m-d H:i:s')) . 'File:' . $e->getFile() . ', Lines: '. $e->getLine() .'行,Exception Message: ' . $e->getMessage() . PHP_EOL;
|
||||||
// 输出堆栈信息
|
// 输出堆栈信息
|
||||||
echo $e->getTraceAsString() . PHP_EOL;
|
echo sprintf('[%s]: ', date('Y-m-d H:i:s')) . $e->getTraceAsString() . PHP_EOL;
|
||||||
// 日志记录
|
// 日志记录
|
||||||
$this->recordLog($startAt, 'File:' . $e->getFile() . ', Lines: '. $e->getLine() .'行,Exception Message: ' . $e->getMessage());
|
$this->recordLog($startAt, 'File:' . $e->getFile() . ', Lines: '. $e->getLine() .'行,Exception Message: ' . $e->getMessage());
|
||||||
$this->exceptionHappenTimes += 1;
|
$this->exceptionHappenTimes += 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user