aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2024-06-25 17:03:19 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2024-07-02 15:03:18 +0200
commit2ba0819243cfe5eedf148b6ff19d5070f1ff7844 (patch)
tree08aa972fb13182e132e5d9e97fd92216e79224db /lib
parent72b6db40435ce0407d0aafa626945d4f2380460f (diff)
downloadnextcloud-server-2ba0819243cfe5eedf148b6ff19d5070f1ff7844.tar.gz
nextcloud-server-2ba0819243cfe5eedf148b6ff19d5070f1ff7844.zip
feat(occ): Add a --debug option to output all log levels to the output
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php12
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
3 files changed, 14 insertions, 0 deletions
diff --git a/lib/base.php b/lib/base.php
index 91ca87426e1..894d9b7279f 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -63,6 +63,7 @@ class OC {
* check if Nextcloud runs in cli mode
*/
public static bool $CLI = false;
+ public static bool $CLI_DEBUG = false;
public static \OC\Autoloader $loader;
@@ -556,6 +557,12 @@ class OC {
self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php';
self::$composerAutoloader->setApcuPrefix(null);
+ if (self::$CLI && ($key = array_search('--debug', $_SERVER['argv'])) !== false) {
+ self::$CLI_DEBUG = true;
+ } else {
+ self::$CLI_DEBUG = false;
+ }
+
try {
self::initPaths();
// setup 3rdparty autoloader
@@ -578,6 +585,11 @@ class OC {
self::$server = new \OC\Server(\OC::$WEBROOT, self::$config);
self::$server->boot();
+ if (self::$CLI_DEBUG) {
+ $eventDispatcher = \OCP\Server::get(IEventDispatcher::class);
+ $eventDispatcher->addServiceListener(\OCP\Log\BeforeMessageLoggedEvent::class, \OC\Core\Listener\BeforeMessageLoggedEventListener::class);
+ }
+
$eventLogger = Server::get(\OCP\Diagnostics\IEventLogger::class);
$eventLogger->log('autoloader', 'Autoloader', $loaderStart, $loaderEnd);
$eventLogger->start('boot', 'Initialize');
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 9fa3b5bf765..322bae15fae 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -1236,6 +1236,7 @@ return array(
'OC\\Core\\Events\\PasswordResetEvent' => $baseDir . '/core/Events/PasswordResetEvent.php',
'OC\\Core\\Exception\\LoginFlowV2NotFoundException' => $baseDir . '/core/Exception/LoginFlowV2NotFoundException.php',
'OC\\Core\\Exception\\ResetPasswordException' => $baseDir . '/core/Exception/ResetPasswordException.php',
+ 'OC\\Core\\Listener\\BeforeMessageLoggedEventListener' => $baseDir . '/core/Listener/BeforeMessageLoggedEventListener.php',
'OC\\Core\\Listener\\BeforeTemplateRenderedListener' => $baseDir . '/core/Listener/BeforeTemplateRenderedListener.php',
'OC\\Core\\Middleware\\TwoFactorMiddleware' => $baseDir . '/core/Middleware/TwoFactorMiddleware.php',
'OC\\Core\\Migrations\\Version13000Date20170705121758' => $baseDir . '/core/Migrations/Version13000Date20170705121758.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 38d06cbc9e3..2334c0bb7e8 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -1269,6 +1269,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Core\\Events\\PasswordResetEvent' => __DIR__ . '/../../..' . '/core/Events/PasswordResetEvent.php',
'OC\\Core\\Exception\\LoginFlowV2NotFoundException' => __DIR__ . '/../../..' . '/core/Exception/LoginFlowV2NotFoundException.php',
'OC\\Core\\Exception\\ResetPasswordException' => __DIR__ . '/../../..' . '/core/Exception/ResetPasswordException.php',
+ 'OC\\Core\\Listener\\BeforeMessageLoggedEventListener' => __DIR__ . '/../../..' . '/core/Listener/BeforeMessageLoggedEventListener.php',
'OC\\Core\\Listener\\BeforeTemplateRenderedListener' => __DIR__ . '/../../..' . '/core/Listener/BeforeTemplateRenderedListener.php',
'OC\\Core\\Middleware\\TwoFactorMiddleware' => __DIR__ . '/../../..' . '/core/Middleware/TwoFactorMiddleware.php',
'OC\\Core\\Migrations\\Version13000Date20170705121758' => __DIR__ . '/../../..' . '/core/Migrations/Version13000Date20170705121758.php',