How to separate error and info into different files in laravel5.5?
This is my code in bootstrap/app.php
But errors will appear in both error.log
and lumen.log
$app->configureMonologUsing(function (\Monolog\Logger $monolog) use ($app) {
$handlerError = new \Monolog\Handler\RotatingFileHandler(storage_path('logs/error.log'), $app->make('config')->get('app.log_max_files', 5), \Monolog\Logger::ERROR);
$handlerInfo = new \Monolog\Handler\RotatingFileHandler(storage_path('logs/lumen.log'), $app->make('config')->get('app.log_max_files', 5), \Monolog\Logger::INFO);
$monolog->pushHandler($handlerError);
$monolog->pushHandler($handlerInfo);
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire