From c9c38566fc7f422587cc02fcecf3d518fdc5bf85 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 10 Apr 2018 23:52:41 +0200 Subject: [PATCH] Set the default log rotate size to 100 MB Signed-off-by: Morris Jobke --- config/config.sample.php | 4 ++-- core/Command/Log/File.php | 2 +- lib/private/Log/Rotate.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/config.sample.php b/config/config.sample.php index ba5f3d68146ec..d1341feb0d2dc 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -764,9 +764,9 @@ * 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 e5db2c1acc404..8be01d2b6ef29 100644 --- a/core/Command/Log/File.php +++ b/core/Command/Log/File.php @@ -105,7 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $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 d7c554374fde6..97a772b5251f1 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) {