Merge pull request #1598 from flarum/dk/log-rotation

adds log rotation, reducing file size per log file and easier to delete
This commit is contained in:
Franz Liedke 2018-10-10 00:27:39 +02:00 committed by GitHub
commit 9fa7258325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,7 +43,7 @@ use Illuminate\Mail\MailServiceProvider;
use Illuminate\Validation\ValidationServiceProvider;
use Illuminate\View\ViewServiceProvider;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
@ -219,7 +219,7 @@ class InstalledSite implements SiteInterface
private function registerLogger(Application $app)
{
$logPath = $app->storagePath().'/logs/flarum.log';
$handler = new StreamHandler($logPath, Logger::INFO);
$handler = new RotatingFileHandler($logPath, Logger::INFO);
$handler->setFormatter(new LineFormatter(null, null, true, true));
$app->instance('log', new Logger($app->environment(), [$handler]));