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;