summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-09-29 18:25:24 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-09-29 18:25:24 +0200
commit4c912e66db3f60acc2234e9811a4d5f37810a0c8 (patch)
treef9331304318ea07dcc99a1db94379184ceeca5b6
parent5f81a5e6411a82c7a7c8b2a93a73c7ee5a975ff5 (diff)
parent3f79484c45cb32118bb79e6e82336157b164cb2d (diff)
downloadnextcloud-server-4c912e66db3f60acc2234e9811a4d5f37810a0c8.tar.gz
nextcloud-server-4c912e66db3f60acc2234e9811a4d5f37810a0c8.zip
Merge pull request #19447 from owncloud/stable8-backport-19441
[stable8][upgrade] switch to debug logging on upgrade
-rw-r--r--core/ajax/update.php6
-rw-r--r--core/command/upgrade.php6
-rw-r--r--lib/private/updater.php16
3 files changed, 28 insertions, 0 deletions
diff --git a/core/ajax/update.php b/core/ajax/update.php
index 6d2dccfac7d..ad0e9ca5c44 100644
--- a/core/ajax/update.php
+++ b/core/ajax/update.php
@@ -54,6 +54,12 @@ if (OC::checkUpgrade(false)) {
$eventSource->close();
OC_Config::setValue('maintenance', false);
});
+ $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use($eventSource, $l) {
+ $eventSource->send('success', (string)$l->t('Set log level to debug - current level: "%s"', [ $logLevelName ]));
+ });
+ $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($eventSource, $l) {
+ $eventSource->send('success', (string)$l->t('Reset log level to "%s"', [ $logLevelName ]));
+ });
$updater->upgrade();
diff --git a/core/command/upgrade.php b/core/command/upgrade.php
index d269d993f6b..de5cd71f61f 100644
--- a/core/command/upgrade.php
+++ b/core/command/upgrade.php
@@ -142,6 +142,12 @@ class Upgrade extends Command {
$updater->listen('\OC\Updater', 'failure', function ($message) use($output, $self) {
$output->writeln("<error>$message</error>");
});
+ $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use($output) {
+ $output->writeln("<info>Set log level to debug - current level: '$logLevelName'</info>");
+ });
+ $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($output) {
+ $output->writeln("<info>Reset log level to '$logLevelName'</info>");
+ });
$success = $updater->upgrade();
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 4d2f3ab7d75..2980e940aaa 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -8,6 +8,7 @@
namespace OC;
+use OC\Core\Command\Log\Manage;
use OC\Hooks\BasicEmitter;
use OC_App;
use OC_Util;
@@ -42,6 +43,14 @@ class Updater extends BasicEmitter {
/** @var bool */
private $skip3rdPartyAppsDisable;
+ private $logLevelNames = [
+ 0 => 'Debug',
+ 1 => 'Info',
+ 2 => 'Warning',
+ 3 => 'Error',
+ 4 => 'Fatal',
+ ];
+
/**
* @param HTTPHelper $httpHelper
* @param IConfig $config
@@ -150,6 +159,10 @@ class Updater extends BasicEmitter {
* @return bool true if the operation succeeded, false otherwise
*/
public function upgrade() {
+ $logLevel = $this->config->getSystemValue('loglevel', \OCP\Util::WARN);
+ $this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
+ $this->config->setSystemValue('loglevel', \OCP\Util::DEBUG);
+
$this->config->setSystemValue('maintenance', true);
$installedVersion = $this->config->getSystemValue('version', '0.0.0');
@@ -172,6 +185,9 @@ class Updater extends BasicEmitter {
$this->emit('\OC\Updater', 'maintenanceEnd');
$this->emit('\OC\Updater', 'updateEnd', array($success));
+ $this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
+ $this->config->setSystemValue('loglevel', $logLevel);
+
return $success;
}