Laravel Monolog. Log INFO level to separate file

此生再无相见时 提交于 2019-12-10 16:48:13

问题


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


回答1:


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;


来源:https://stackoverflow.com/questions/32286010/laravel-monolog-log-info-level-to-separate-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!