aboutsummaryrefslogtreecommitdiffstats
path: root/cron.php
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 /cron.php
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 'cron.php')
-rw-r--r--cron.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/cron.php b/cron.php
index 41c5157befa..a6716a68714 100644
--- a/cron.php
+++ b/cron.php
@@ -148,7 +148,8 @@ try {
break;
}
- $logger->debug('CLI cron call has selected job with ID ' . strval($job->getId()), ['app' => 'cron']);
+ $jobDetails = get_class($this) . ' (id: ' . $this->getId() . ', arguments: ' . json_encode($this->getArgument()) . ')';
+ $logger->debug('CLI cron call has selected job ' . $jobDetails, ['app' => 'cron']);
$memoryBefore = memory_get_usage();
$memoryPeakBefore = memory_get_peak_usage();
@@ -159,10 +160,10 @@ try {
$memoryPeakAfter = memory_get_peak_usage();
if ($memoryAfter - $memoryBefore > 10_000_000) {
- $logger->warning('Used memory grew by more than 10 MB when executing job ' . get_class($job) . ' : ' . \OCP\Util::humanFileSize($memoryAfter). ' (before: ' . \OCP\Util::humanFileSize($memoryBefore) . ')', ['app' => 'cron']);
+ $logger->warning('Used memory grew by more than 10 MB when executing job ' . $jobDetails . ': ' . \OCP\Util::humanFileSize($memoryAfter). ' (before: ' . \OCP\Util::humanFileSize($memoryBefore) . ')', ['app' => 'cron']);
}
if ($memoryPeakAfter > 300_000_000) {
- $logger->warning('Cron job used more than 300 MB of ram after executing job ' . get_class($job) . ': ' . \OCP\Util::humanFileSize($memoryPeakAfter) . ' (before: ' . \OCP\Util::humanFileSize($memoryPeakBefore) . ')', ['app' => 'cron']);
+ $logger->warning('Cron job used more than 300 MB of ram after executing job ' . $jobDetails . ': ' . \OCP\Util::humanFileSize($memoryPeakAfter) . ' (before: ' . \OCP\Util::humanFileSize($memoryPeakBefore) . ')', ['app' => 'cron']);
}
// clean up after unclean jobs