Dmitrii G.
Dmitrii G.

Reputation: 895

Laravel Monolog. Log INFO level to separate file

How to specify a separate file for logging INFO level in Laravel 5.1 and monolog?

Upvotes: 4

Views: 3013

Answers (1)

absolux
absolux

Reputation: 323

If you would like add another monolog handler, you may use the application's configureMonologUsing method. You should place a call to this method in bootstrap/app.php file right before the $app variable is returned:

$app->configureMonologUsing(function($monolog) {
    $monolog->pushHandler(new StreamHandler('path/to/info.log', Logger::INFO, false)); // false value as third argument to disable bubbling up the stack
});

return $app;

Upvotes: 3

Related Questions