Skip to content


How-to Guides

Technical References

Manually log errors in New Relic

For debugging purposes, you may want to manually log custom errors in PHP code using the trigger_error() function, along with a minimum error level (second argument) of E_USER_WARNING. The default is E_USER_NOTICE.

However, on VIP Go, you have the ability to log custom errors in New Relic using its methods.

The function newrelic_notice_error() is available to log custom errors in New Relic. To trigger an error, you can implement something like the following:

if ( extension_loaded( 'newrelic' ) ) {
    newrelic_notice_error( 'My custom error message' );

The function documentation is available here.


If there are multiple calls to newrelic_notice_error() in a single transaction, the PHP agent will retain the exception from the last call only.

Alternatively, you can use the newrelic_record_custom_event() function to keep track of data and log events without considering it to be an error.

The newrelic_record_custom_event() function documentation explains how to use that.

Last updated: April 09, 2021