Skip to content

Commit bc8aaff

Browse files
committed
fix: make rotate logs a TimedJob and run every 5s
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
1 parent 5d81e74 commit bc8aaff

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lib/private/Log/Rotate.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*/
88
namespace OC\Log;
99

10+
use OCP\AppFramework\Utility\ITimeFactory;
11+
use OCP\BackgroundJob\TimedJob;
1012
use OCP\IConfig;
1113
use OCP\Log\RotationTrait;
1214
use Psr\Log\LoggerInterface;
@@ -17,9 +19,15 @@
1719
* For more professional log management set the 'logfile' config to a different
1820
* location and manage that with your own tools.
1921
*/
20-
class Rotate extends \OCP\BackgroundJob\Job {
22+
class Rotate extends TimedJob {
2123
use RotationTrait;
2224

25+
public function __construct(ITimeFactory $time) {
26+
parent::__construct($time);
27+
28+
$this->setInterval(5);
29+
}
30+
2331
public function run($argument): void {
2432
$config = \OCP\Server::get(IConfig::class);
2533
$this->filePath = $config->getSystemValueString('logfile', $config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log');

0 commit comments

Comments
 (0)