aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorfenn-cs <fenn25.fn@gmail.com>2023-03-28 21:20:08 +0100
committerfenn-cs <fenn25.fn@gmail.com>2023-05-22 15:17:04 +0100
commitbb2c2bb7f0aa57ad7e77a914fb341e2535801da9 (patch)
treef9400bbcb4c0172fab9ccd03cd8ecee840cd3fd8 /index.php
parent96f01183123c7745260e0fa2fbe02cbec3a23166 (diff)
downloadnextcloud-server-bb2c2bb7f0aa57ad7e77a914fb341e2535801da9.tar.gz
nextcloud-server-bb2c2bb7f0aa57ad7e77a914fb341e2535801da9.zip
Replace ILogger method calls index.php
This commit replaces more ILogger method calls with `Psr\Log\LoggerInterface` as we gradually move away from the custom ILogger. This commit aslo, sets the customPsrLogger to not depend on the database to `logfile` config value. Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Diffstat (limited to 'index.php')
-rw-r--r--index.php26
1 files changed, 21 insertions, 5 deletions
diff --git a/index.php b/index.php
index 7b62f17e5bd..f57cc03dd5e 100644
--- a/index.php
+++ b/index.php
@@ -29,13 +29,17 @@
*
*/
require_once __DIR__ . '/lib/versioncheck.php';
+use Psr\Log\LoggerInterface;
try {
require_once __DIR__ . '/lib/base.php';
OC::handleRequest();
} catch (\OC\ServiceUnavailableException $ex) {
- \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
+ \OC::$server->get(LoggerInterface::class)->error($ex->getMessage(), [
+ 'app' => 'index',
+ 'exception' => $ex,
+ ]);
//show the user a detailed error page
OC_Template::printExceptionErrorPage($ex, 503);
@@ -44,8 +48,14 @@ try {
OC_Template::printErrorPage($ex->getMessage(), $ex->getHint(), 503);
} catch (Exception $ex2) {
try {
- \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
- \OC::$server->getLogger()->logException($ex2, ['app' => 'index']);
+ \OC::$server->get(LoggerInterface::class)->error($ex->getMessage(), [
+ 'app' => 'index',
+ 'exception' => $ex,
+ ]);
+ \OC::$server->get(LoggerInterface::class)->error($ex2->getMessage(), [
+ 'app' => 'index',
+ 'exception' => $ex2,
+ ]);
} catch (Throwable $e) {
// no way to log it properly - but to avoid a white page of death we try harder and ignore this one here
}
@@ -68,13 +78,19 @@ try {
}
OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), 401);
} catch (Exception $ex) {
- \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
+ \OC::$server->get(LoggerInterface::class)->error($ex->getMessage(), [
+ 'app' => 'index',
+ 'exception' => $ex,
+ ]);
//show the user a detailed error page
OC_Template::printExceptionErrorPage($ex, 500);
} catch (Error $ex) {
try {
- \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
+ \OC::$server->get(LoggerInterface::class)->error($ex->getMessage(), [
+ 'app' => 'index',
+ 'exception' => $ex,
+ ]);
} catch (Error $e) {
http_response_code(500);
header('Content-Type: text/plain; charset=utf-8');