mirror of
https://github.com/flarum/framework.git
synced 2024-12-03 15:43:59 +08:00
adds log rotation, reducing file size per log file and easier to delete
This commit is contained in:
parent
74fbae0b65
commit
3dde57f9da
|
@ -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]));
|
||||
|
|
Loading…
Reference in New Issue
Block a user