New Relational Error Reporting - Stop E_NOTICE Errors

The problem that I have now is that it is difficult to find the actual errors, since so many E_NOTICE were found. We have about 600 sites with complex scripts on our server, and I have done a lot to process them, but there are still quite a lot of them.

I get an email and text every time the error rate is too high, which is great for preventing problems.

I am sure that I am not the only one who has encountered this problem - is there a recommended solution? I tried to set error_reporting( E_ALL ^ E_NOTICE ); but he did not stop him.

One of the possible solutions that I was thinking about does not set New Relic as an error handler using my own and then sends them an error if it is not E_NOTICE. Until they understood how to do it.

+4
source share
1 answer

New Relic PHP Agent will not trace E_NOTICE errors unless you explicitly used set_error_handler(newrelic_notice_error);

If you want New Relic to track some, but not all, uncaught exceptions, creating your own error handler that raises newrelic_notice_error makes sense.

The New Relic documentation has more info: https://newrelic.com/docs/php/the-php-api

In most cases, it is not necessary or recommended to install New Relic as an error handler.

+8
source

Source: https://habr.com/ru/post/1468871/


All Articles