Manually logging errors in New Relic

VIP Go platform specific

This document is for sites running on VIP Go.

Learn more

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.

Note: 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.

Ready to get started?

Drop us a note.

No matter where you are in the planning process, we’re happy to help, and we’re actual humans here on the other side of the form. 👋 We’re here to discuss your challenges and plans, evaluate your existing resources or a potential partner, or even make some initial recommendations. And, of course, we’re here to help any time you’re in the market for some robust WordPress awesomeness.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.