Laravel 5错误报告抑制 [英] Laravel 5 Error Reporting Suppression
问题描述
我似乎无法做到这一点,因为如果我添加
error_reporting(E_ALL ^ E_NOTICE)
任何地方只会被覆盖。
似乎在这里发生:
(index.php)
$ response = $ kernel-> handle(
$ request = Illuminate\Http\Request :: capture()
);
我添加了自定义代码来处理异常/处理程序中更多漂亮的异常/错误视图。 php但我正在努力关闭通知(我根本不希望任何一个通知通知)
- 是的,这个问题应该是固定的,我知道这一点,但是这样的情况下,我更喜欢没有在现场直接攻击应用程序的通知(我有一个自定义的日志记录解决方案),在开发者我想要通知。
在Laravel 5中,我们可以在 AppServiceProviders :: boot
方法中设置 error_reporting(E_ALL ^ E_NOTICE)
public function boot()
{
//设置任意级别
error_reporting(E_ALL ^ E_NOTICE);
}
In Laravel 4, it was easy enough to suppress E_NOTICE messages; I can't seem to be able to do this because if I add
error_reporting(E_ALL ^ E_NOTICE)
anywhere it simply gets overridden.
This seems to happen around here: (index.php)
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
I have added custom code to handle more "pretty" views of exceptions/errors within Exceptions/Handler.php but I'm struggling to switch off notices (I don't want any of these firing off with notices at all)
- Yes, the issue should be fixed, I'm aware of this, however this is a case where I'd prefer the notices NOT bombing the app on live (I have a custom logging solution for this), and on dev I'd like the notice to show.
In Laravel 5, we can set error_reporting(E_ALL ^ E_NOTICE)
inside the AppServiceProviders::boot
method:
public function boot()
{
//set whatever level you want
error_reporting(E_ALL ^ E_NOTICE);
}
这篇关于Laravel 5错误报告抑制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!