From ebbe8f98b7ffb3b68580a351897c0caec1617c75 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 11 Sep 2023 08:47:35 +0000 Subject: [PATCH 1/2] Added log entry to improve matching with the access log --- src/App.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/App.php b/src/App.php index db3e644c2..dd54e05ee 100644 --- a/src/App.php +++ b/src/App.php @@ -565,6 +565,9 @@ class App */ public function runFrontend(App\Router $router, IManagePersonalConfigValues $pconfig, Authentication $auth, App\Page $page, Nav $nav, ModuleHTTPException $httpException, HTTPInputData $httpInput, float $start_time, array $server) { + $requeststring = ($_SERVER['REQUEST_METHOD'] ?? '') . ' ' . ($_SERVER['REQUEST_URI'] ?? '') . ' ' . ($_SERVER['SERVER_PROTOCOL'] ?? ''); + $this->logger->debug('Got request', ['address' => $_SERVER['REMOTE_ADDR'] ?? '', 'request' => $requeststring, 'referer' => $_SERVER['HTTP_REFERER'] ?? '', 'user-agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']); + $this->profiler->set($start_time, 'start'); $this->profiler->set(microtime(true), 'classinit'); From fe2e00f86157a8e26f50732975e2ef4ec8a63697 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 11 Sep 2023 10:18:02 +0000 Subject: [PATCH 2/2] Added logging for the finished processing --- src/App.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/App.php b/src/App.php index dd54e05ee..10fee0cfc 100644 --- a/src/App.php +++ b/src/App.php @@ -566,7 +566,7 @@ class App public function runFrontend(App\Router $router, IManagePersonalConfigValues $pconfig, Authentication $auth, App\Page $page, Nav $nav, ModuleHTTPException $httpException, HTTPInputData $httpInput, float $start_time, array $server) { $requeststring = ($_SERVER['REQUEST_METHOD'] ?? '') . ' ' . ($_SERVER['REQUEST_URI'] ?? '') . ' ' . ($_SERVER['SERVER_PROTOCOL'] ?? ''); - $this->logger->debug('Got request', ['address' => $_SERVER['REMOTE_ADDR'] ?? '', 'request' => $requeststring, 'referer' => $_SERVER['HTTP_REFERER'] ?? '', 'user-agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']); + $this->logger->debug('Request received', ['address' => $_SERVER['REMOTE_ADDR'] ?? '', 'request' => $requeststring, 'referer' => $_SERVER['HTTP_REFERER'] ?? '', 'user-agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']); $this->profiler->set($start_time, 'start'); $this->profiler->set(microtime(true), 'classinit'); @@ -715,8 +715,10 @@ class App $response = $page->run($this, $this->baseURL, $this->args, $this->mode, $response, $this->l10n, $this->profiler, $this->config, $pconfig, $nav, $this->session->getLocalUserId()); } + $this->logger->debug('Request processed sucessfully', ['response' => $response->getStatusCode(), 'address' => $_SERVER['REMOTE_ADDR'] ?? '', 'request' => $requeststring, 'referer' => $_SERVER['HTTP_REFERER'] ?? '', 'user-agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']); $page->exit($response); } catch (HTTPException $e) { + $this->logger->debug('Request processed with exception', ['response' => $e->getCode(), 'address' => $_SERVER['REMOTE_ADDR'] ?? '', 'request' => $requeststring, 'referer' => $_SERVER['HTTP_REFERER'] ?? '', 'user-agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']); $httpException->rawContent($e); } $page->logRuntime($this->config, 'runFrontend');