Skip to content

Commit

Permalink
Set the default log rotate size to 100 MB
Browse files Browse the repository at this point in the history
Signed-off-by: Morris Jobke <[email protected]>
  • Loading branch information
MorrisJobke authored and rullzer committed Apr 10, 2018
1 parent 323ee3c commit c9c3856
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,


/**
Expand Down
2 changes: 1 addition & 1 deletion core/Command/Log/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Log/Rotate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c9c3856

Please sign in to comment.