diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-04-10 23:52:41 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-04-11 00:27:51 +0200 |
commit | 058f8123e61863f27ca138370853f71f70e90233 (patch) | |
tree | f00a3ecbb059183fae01838b39c421eb039bf47c | |
parent | 323ee3cbdc420f1009b6eb64b2df0f878ff39a14 (diff) | |
download | nextcloud-server-058f8123e61863f27ca138370853f71f70e90233.tar.gz nextcloud-server-058f8123e61863f27ca138370853f71f70e90233.zip |
Set the default log rotate size to 100 MB
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r-- | config/config.sample.php | 4 | ||||
-rw-r--r-- | core/Command/Log/File.php | 2 | ||||
-rw-r--r-- | lib/private/Log/Rotate.php | 2 | ||||
-rw-r--r-- | tests/Core/Command/Log/FileTest.php | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index ba5f3d68146..d1341feb0d2 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -764,9 +764,9 @@ $CONFIG = array( * old logfile reaches your limit. If a rotated log file is already present, it * will be overwritten. * - * Defaults to ``0`` (no rotation) + * Defaults to 100 MB */ -'log_rotate_size' => false, +'log_rotate_size' => 100 * 1024 * 1024, /** diff --git a/core/Command/Log/File.php b/core/Command/Log/File.php index e5db2c1acc4..8be01d2b6ef 100644 --- a/core/Command/Log/File.php +++ b/core/Command/Log/File.php @@ -105,7 +105,7 @@ class File extends Command implements Completion\CompletionAwareInterface { $defaultLogFile = rtrim($dataDir, '/').'/nextcloud.log'; $output->writeln('Log file: '.$this->config->getSystemValue('logfile', $defaultLogFile)); - $rotateSize = $this->config->getSystemValue('log_rotate_size', 0); + $rotateSize = $this->config->getSystemValue('log_rotate_size', 100*1024*1024); if ($rotateSize) { $rotateString = \OCP\Util::humanFileSize($rotateSize); } else { diff --git a/lib/private/Log/Rotate.php b/lib/private/Log/Rotate.php index d7c554374fd..97a772b5251 100644 --- a/lib/private/Log/Rotate.php +++ b/lib/private/Log/Rotate.php @@ -36,7 +36,7 @@ class Rotate extends \OC\BackgroundJob\Job { public function run($dummy) { $systemConfig = \OC::$server->getSystemConfig(); $logFile = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log'); - $this->max_log_size = \OC::$server->getConfig()->getSystemValue('log_rotate_size', false); + $this->max_log_size = \OC::$server->getConfig()->getSystemValue('log_rotate_size', 100 * 1024 * 1024); if ($this->max_log_size) { $filesize = @filesize($logFile); if ($filesize >= $this->max_log_size) { diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php index 4270684c9b6..4b8845277da 100644 --- a/tests/Core/Command/Log/FileTest.php +++ b/tests/Core/Command/Log/FileTest.php @@ -105,7 +105,7 @@ class FileTest extends TestCase { ['log_type', 'file', 'log_type_value'], ['datadirectory', \OC::$SERVERROOT.'/data', '/data/directory/'], ['logfile', '/data/directory/nextcloud.log', '/var/log/nextcloud.log'], - ['log_rotate_size', 0, 5 * 1024 * 1024], + ['log_rotate_size', 100 * 1024 * 1024, 5 * 1024 * 1024], ])); $this->consoleOutput->expects($this->at(0)) |