Laravel Monolog.记录INFO级别以分离文件 [英] Laravel Monolog. Log INFO level to separate file

查看:67
本文介绍了Laravel Monolog.记录INFO级别以分离文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Laravel 5.1和monolog中指定用于记录INFO级别的单独文件?

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

推荐答案

如果您想添加另一个独白处理程序,则可以使用应用程序的configureMonologUsing方法.您应该在返回$ app变量之前,在bootstrap/app.php文件中对该方法进行调用:

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;

这篇关于Laravel Monolog.记录INFO级别以分离文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆