Laravel Monolog. Log INFO level to separate file

2019-06-24 08:28发布

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

1条回答
姐就是有狂的资本
2楼-- · 2019-06-24 09:21

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;
查看更多
登录 后发表回答