From baf75adfca478a3676b37fb1d41f0b2d750e86b2 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 16 Feb 2023 20:47:37 +0000 Subject: [PATCH] =?UTF-8?q?Some=20loglevels=20are=20adjusted=20to=20more?= =?UTF-8?q?=20reasonabl=C3=B6e=20levels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Core/System.php | 2 +- src/Core/Worker.php | 12 ++++++------ src/Model/APContact.php | 2 +- src/Module/DFRN/Notify.php | 2 +- .../Notifications/Repository/Notification.php | 2 +- src/Network/HTTPClient/Factory/HttpClient.php | 2 +- src/Protocol/ActivityPub/Processor.php | 12 ++++++------ src/Protocol/Diaspora.php | 2 +- src/Util/HTTPSignature.php | 7 ++++--- src/Util/LDSignature.php | 2 +- 10 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/Core/System.php b/src/Core/System.php index 42f5ab36ae..bbcb3ab09e 100644 --- a/src/Core/System.php +++ b/src/Core/System.php @@ -166,7 +166,7 @@ class System $load = System::currentLoad(); if ($load) { if (intval($load) > $maxsysload) { - $this->logger->warning('system load for process too high.', ['load' => $load, 'process' => 'backend', 'maxsysload' => $maxsysload]); + $this->logger->notice('system load for process too high.', ['load' => $load, 'process' => 'backend', 'maxsysload' => $maxsysload]); return true; } } diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 90bce0a88e..9d1fde85c9 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -141,7 +141,7 @@ class Worker if (DI::lock()->acquire(self::LOCK_WORKER, 0)) { // Count active workers and compare them with a maximum value that depends on the load if (self::tooMuchWorkers()) { - Logger::notice('Active worker limit reached, quitting.'); + Logger::info('Active worker limit reached, quitting.'); DI::lock()->release(self::LOCK_WORKER); return; } @@ -188,7 +188,7 @@ class Worker { // Count active workers and compare them with a maximum value that depends on the load if (self::tooMuchWorkers()) { - Logger::notice('Active worker limit reached, quitting.'); + Logger::info('Active worker limit reached, quitting.'); return false; } @@ -511,7 +511,7 @@ class Worker while ($load = System::getLoadAvg($processes_cooldown != 0)) { if (($load_cooldown > 0) && ($load['average1'] > $load_cooldown)) { if (!$sleeping) { - Logger::notice('Load induced pre execution cooldown.', ['max' => $load_cooldown, 'load' => $load, 'called-by' => System::callstack(1)]); + Logger::info('Load induced pre execution cooldown.', ['max' => $load_cooldown, 'load' => $load, 'called-by' => System::callstack(1)]); $sleeping = true; } sleep(1); @@ -519,7 +519,7 @@ class Worker } if (($processes_cooldown > 0) && ($load['scheduled'] > $processes_cooldown)) { if (!$sleeping) { - Logger::notice('Process induced pre execution cooldown.', ['max' => $processes_cooldown, 'load' => $load, 'called-by' => System::callstack(1)]); + Logger::info('Process induced pre execution cooldown.', ['max' => $processes_cooldown, 'load' => $load, 'called-by' => System::callstack(1)]); $sleeping = true; } sleep(1); @@ -529,7 +529,7 @@ class Worker } if ($sleeping) { - Logger::notice('Cooldown ended.', ['max-load' => $load_cooldown, 'max-processes' => $processes_cooldown, 'load' => $load, 'called-by' => System::callstack(1)]); + Logger::info('Cooldown ended.', ['max-load' => $load_cooldown, 'max-processes' => $processes_cooldown, 'load' => $load, 'called-by' => System::callstack(1)]); } } @@ -814,7 +814,7 @@ class Worker } } - Logger::notice('Load: ' . $load . '/' . $maxsysload . ' - processes: ' . $deferred . '/' . $active . '/' . $waiting_processes . $processlist . ' - maximum: ' . $queues . '/' . $maxqueues); + Logger::info('Load: ' . $load . '/' . $maxsysload . ' - processes: ' . $deferred . '/' . $active . '/' . $waiting_processes . $processlist . ' - maximum: ' . $queues . '/' . $maxqueues); // Are there fewer workers running as possible? Then fork a new one. if (!DI::config()->get('system', 'worker_dont_fork', false) && ($queues > ($active + 1)) && self::entriesExists() && !self::systemLimitReached()) { diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 71446e9696..215d7e317d 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -169,7 +169,7 @@ class APContact $cachekey = 'apcontact:' . ItemURI::getIdByURI($url); $result = DI::cache()->get($cachekey); if (!is_null($result)) { - Logger::notice('Multiple requests for the address', ['url' => $url, 'update' => $update, 'callstack' => System::callstack(20), 'result' => $result]); + Logger::info('Multiple requests for the address', ['url' => $url, 'update' => $update, 'callstack' => System::callstack(20), 'result' => $result]); if (!empty($fetched_contact)) { return $fetched_contact; } diff --git a/src/Module/DFRN/Notify.php b/src/Module/DFRN/Notify.php index 6001ae6dc0..ce44dec805 100644 --- a/src/Module/DFRN/Notify.php +++ b/src/Module/DFRN/Notify.php @@ -80,7 +80,7 @@ class Notify extends BaseModule $msg = Diaspora::decodeRaw($postdata, '', true); if (!is_array($msg)) { // We have to fail silently to be able to hand it over to the salmon parser - $this->logger->warning('Diaspora::decodeRaw() has failed for some reason.'); + $this->logger->warning('Diaspora::decodeRaw() has failed for some reason.', ['post-data' => $postdata]); return false; } diff --git a/src/Navigation/Notifications/Repository/Notification.php b/src/Navigation/Notifications/Repository/Notification.php index 078346445f..777832de6d 100644 --- a/src/Navigation/Notifications/Repository/Notification.php +++ b/src/Navigation/Notifications/Repository/Notification.php @@ -282,7 +282,7 @@ class Notification extends BaseRepository 'parent-uri-id' => $itemUriId, ]; - $this->logger->notice('deleteForItem', ['conditionTarget' => $conditionTarget, 'conditionParent' => $conditionParent]); + $this->logger->info('deleteForItem', ['conditionTarget' => $conditionTarget, 'conditionParent' => $conditionParent]); return $this->db->delete(self::$table_name, $conditionTarget) diff --git a/src/Network/HTTPClient/Factory/HttpClient.php b/src/Network/HTTPClient/Factory/HttpClient.php index 20b999919f..5d01d3e126 100644 --- a/src/Network/HTTPClient/Factory/HttpClient.php +++ b/src/Network/HTTPClient/Factory/HttpClient.php @@ -83,7 +83,7 @@ class HttpClient extends BaseFactory ResponseInterface $response, UriInterface $uri ) use ($logger) { - $logger->notice('Curl redirect.', ['url' => $request->getUri(), 'to' => $uri, 'method' => $request->getMethod()]); + $logger->info('Curl redirect.', ['url' => $request->getUri(), 'to' => $uri, 'method' => $request->getMethod()]); }; $userAgent = App::PLATFORM . " '" . diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 6836eafe34..11267cfaf5 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -505,7 +505,7 @@ class Processor $recursion_depth = $activity['recursion-depth'] ?? 0; if (!$in_background && ($recursion_depth < DI::config()->get('system', 'max_recursion_depth'))) { - Logger::notice('Parent not found. Try to refetch it.', ['parent' => $activity['reply-to-id'], 'recursion-depth' => $recursion_depth]); + Logger::info('Parent not found. Try to refetch it.', ['parent' => $activity['reply-to-id'], 'recursion-depth' => $recursion_depth]); $result = self::fetchMissingActivity($activity['reply-to-id'], $activity, '', Receiver::COMPLETION_AUTO); if (empty($result) && self::isActivityGone($activity['reply-to-id'])) { Logger::notice('The activity is gone, the queue entry will be deleted', ['parent' => $activity['reply-to-id']]); @@ -516,10 +516,10 @@ class Processor } elseif (!empty($result)) { $exists = Post::exists(['uri' => [$result, $activity['reply-to-id']]]); if ($exists) { - Logger::notice('The activity has been fetched and created.', ['parent' => $result]); + Logger::info('The activity has been fetched and created.', ['parent' => $result]); return $result; } elseif (DI::config()->get('system', 'fetch_by_worker') || DI::config()->get('system', 'decoupled_receiver')) { - Logger::notice('The activity has been fetched and will hopefully be created later.', ['parent' => $result]); + Logger::info('The activity has been fetched and will hopefully be created later.', ['parent' => $result]); } else { Logger::notice('The activity exists but has not been created, the queue entry will be deleted.', ['parent' => $result]); if (!empty($activity['entry-id'])) { @@ -1561,11 +1561,11 @@ class Processor } if (($completion == Receiver::COMPLETION_RELAY) && Queue::exists($url, 'as:Create')) { - Logger::notice('Activity has already been queued.', ['url' => $url, 'object' => $activity['id']]); + Logger::info('Activity has already been queued.', ['url' => $url, 'object' => $activity['id']]); } elseif (ActivityPub\Receiver::processActivity($ldactivity, json_encode($activity), $uid, true, false, $signer, '', $completion)) { - Logger::notice('Activity had been fetched and processed.', ['url' => $url, 'entry' => $child['entry-id'] ?? 0, 'completion' => $completion, 'object' => $activity['id']]); + Logger::info('Activity had been fetched and processed.', ['url' => $url, 'entry' => $child['entry-id'] ?? 0, 'completion' => $completion, 'object' => $activity['id']]); } else { - Logger::notice('Activity had been fetched and will be processed later.', ['url' => $url, 'entry' => $child['entry-id'] ?? 0, 'completion' => $completion, 'object' => $activity['id']]); + Logger::info('Activity had been fetched and will be processed later.', ['url' => $url, 'entry' => $child['entry-id'] ?? 0, 'completion' => $completion, 'object' => $activity['id']]); } return $activity['id']; diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index fd000dbe8e..271b71b893 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -792,7 +792,7 @@ class Diaspora */ private static function key(WebFingerUri $uri): string { - Logger::notice('Fetching diaspora key', ['handle' => $uri->getAddr(), 'callstack' => System::callstack(20)]); + Logger::info('Fetching diaspora key', ['handle' => $uri->getAddr(), 'callstack' => System::callstack(20)]); try { return DI::dsprContact()->getByAddr($uri)->pubKey; } catch (HTTPException\NotFoundException|\InvalidArgumentException $e) { diff --git a/src/Util/HTTPSignature.php b/src/Util/HTTPSignature.php index 3936c70fcb..f082fe32f7 100644 --- a/src/Util/HTTPSignature.php +++ b/src/Util/HTTPSignature.php @@ -347,12 +347,13 @@ class HTTPSignature if (!empty($gsid)) { $insertFields['gsid'] = $gsid; } - if (!DBA::insert('inbox-status', $insertFields, Database::INSERT_IGNORE)) { + DBA::insert('inbox-status', $insertFields, Database::INSERT_IGNORE); + + $status = DBA::selectFirst('inbox-status', [], ['url' => $url]); + if (empty($status)) { Logger::warning('Unable to insert inbox-status row', $insertFields); return; } - - $status = DBA::selectFirst('inbox-status', [], ['url' => $url]); } if ($success) { diff --git a/src/Util/LDSignature.php b/src/Util/LDSignature.php index 359fbdf17d..8cfadb16da 100644 --- a/src/Util/LDSignature.php +++ b/src/Util/LDSignature.php @@ -69,7 +69,7 @@ class LDSignature $dhash = self::hash(self::signableData($data)); $x = Crypto::rsaVerify($ohash . $dhash, base64_decode($data['signature']['signatureValue']), $pubkey); - Logger::notice('LD-verify', ['verified' => (int)$x, 'actor' => $profile['url']]); + Logger::info('LD-verify', ['verified' => (int)$x, 'actor' => $profile['url']]); if (empty($x)) { return false;