Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/private/Log/Rotate.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
namespace OC\Log;

use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
use OCP\Log\RotationTrait;
use Psr\Log\LoggerInterface;
Expand All @@ -17,9 +19,15 @@
* For more professional log management set the 'logfile' config to a different
* location and manage that with your own tools.
*/
class Rotate extends \OCP\BackgroundJob\Job {
class Rotate extends TimedJob {
use RotationTrait;

public function __construct(ITimeFactory $time) {
parent::__construct($time);

$this->setInterval(3600);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should eliminate this magic number (stick in in RotationTrait?) and then also use it elsewhere and keep rotation consistent across the board:

$this->setInterval(60 * 60 * 3);

$this->setInterval(60 * 60 * 3);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not, but let’s not delay this PR any longer for this. It can be done later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what if a 1h junk is much bigger than the configured limit?
previously it ran on every execution?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickvergessen we discussed this here #53420 (comment) and concluded to set it to 1h, could you check with Côme or Benjamin?

}

public function run($argument): void {
$config = \OCP\Server::get(IConfig::class);
$this->filePath = $config->getSystemValueString('logfile', $config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log');
Expand Down
Loading