Skip to content

Commit

Permalink
Merge pull request #2914 from nextcloud/logrotate-logfile
Browse files Browse the repository at this point in the history
Get the logfile location while running the logrotate cron job instead…
  • Loading branch information
MorrisJobke committed Jan 10, 2017
2 parents aee1100 + 54f96e5 commit 30689f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ public static function registerLogRotate() {
if ($systemConfig->getValue('installed', false) && $systemConfig->getValue('log_rotate_size', false) && !self::checkUpgrade(false)) {
//don't try to do this before we are properly setup
//use custom logfile path if defined, otherwise use default of nextcloud.log in data directory
\OCP\BackgroundJob::registerJob('OC\Log\Rotate', $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', OC::$SERVERROOT . '/data') . '/nextcloud.log'));
\OC::$server->getJobList()->add('OC\Log\Rotate');
}
}

Expand Down
4 changes: 3 additions & 1 deletion lib/private/Log/Rotate.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
*/
class Rotate extends \OC\BackgroundJob\Job {
private $max_log_size;
public function run($logFile) {
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);
if ($this->max_log_size) {
$filesize = @filesize($logFile);
Expand Down

0 comments on commit 30689f3

Please sign in to comment.