New Relic Error Reporting - Stop Catching E_NOTICE errors

陌路散爱 提交于 2019-12-23 14:19:35

问题


The issue I have right now is that it is hard to find actual bugs because so many E_NOTICEs are found. We have nearly 600 sites on our server with complicated scripts, and I've done a lot to handle a great deal of them, but there are still quite a few.

I receive an email and a text every time the error percentage is too high, which is great to prevent problems.

I'm sure I'm not the only one to encounter this problem -- is there a recommended solution? I've tried setting error_reporting( E_ALL ^ E_NOTICE ); but it hasn't stopped it.

One possible solution I've thought of is not setting New Relic as the error handler, using my own, and then sending them the error if it's not an E_NOTICE. Haven't figured out how to do this just yet.


回答1:


New Relics's PHP agent will not trace E_NOTICE errors unless you've explicitly used set_error_handler(newrelic_notice_error);

If you'd like New Relic to trace some but not all uncaught exceptions, creating your own error handler which calls newrelic_notice_error would make sense.

There is more information regarding this in the New Relic documentation: https://newrelic.com/docs/php/the-php-api

In most cases, it is not necessary, or advised, to set New Relic as the error handler.



来源:https://stackoverflow.com/questions/15375595/new-relic-error-reporting-stop-catching-e-notice-errors

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