aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2023-12-20 15:35:40 +0100
committerJoas Schilling <coding@schilljs.com>2023-12-20 15:35:40 +0100
commitb8c57efaad12461efdb0f3778594b71952793577 (patch)
tree0c23bd3a0bcb22630c88a3a2ed5290c7165fc24c /lib
parent28b55bba55cb0124d3ad00e5c48a9afe70cd52d3 (diff)
downloadnextcloud-server-b8c57efaad12461efdb0f3778594b71952793577.tar.gz
nextcloud-server-b8c57efaad12461efdb0f3778594b71952793577.zip
fix(log): Improve logging of background job details for better reproduction/debugging
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/public/BackgroundJob/Job.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/public/BackgroundJob/Job.php b/lib/public/BackgroundJob/Job.php
index a574e90e1a0..2842486b74d 100644
--- a/lib/public/BackgroundJob/Job.php
+++ b/lib/public/BackgroundJob/Job.php
@@ -76,16 +76,17 @@ abstract class Job implements IJob, IParallelAwareJob {
$logger = $this->logger ?? \OCP\Server::get(LoggerInterface::class);
try {
+ $jobDetails = get_class($this) . ' (id: ' . $this->getId() . ', arguments: ' . json_encode($this->getArgument()) . ')';
$jobStartTime = $this->time->getTime();
- $logger->debug('Run ' . get_class($this) . ' job with ID ' . $this->getId(), ['app' => 'cron']);
+ $logger->debug('Starting job ' . $jobDetails, ['app' => 'cron']);
$this->run($this->argument);
$timeTaken = $this->time->getTime() - $jobStartTime;
- $logger->debug('Finished ' . get_class($this) . ' job with ID ' . $this->getId() . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']);
+ $logger->debug('Finished job ' . $jobDetails . ' in ' . $timeTaken . ' seconds', ['app' => 'cron']);
$jobList->setExecutionTime($this, $timeTaken);
} catch (\Throwable $e) {
if ($logger) {
- $logger->error('Error while running background job (class: ' . get_class($this) . ', arguments: ' . print_r($this->argument, true) . ')', [
+ $logger->error('Error while running background job ' . $jobDetails, [
'app' => 'core',
'exception' => $e,
]);