Manually log errors in New Relic
For debugging purposes, custom errors can logged in New Relic by either manually adding them to the Runtime Logs via PHP or logged only to New Relic by using the function newrelic_notice_error()
.
Errors can be triggered with code similar to this example:
if ( extension_loaded( 'newrelic' ) ) {
newrelic_notice_error( 'My custom error message' );
}
For more information, refer to New Relic’s function documentation.
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, the newrelic_record_custom_event()
function can be used to keep track of data and log events without considering it to be an error.
For more information, refer to New Relic’s function documentation for newrelic_record_custom_event()
.
Ingest API
NewRelic’s Ingest API can be used to report custom telemetry data including custom events using an HTTP POST
request method. This method provides a response status code that can be used to track the reliability of the ingested data. To obtain an Ingest API license key, submit a request to VIP Support.
Note
The availability of the Ingest API is intended only for troubleshooting complex issues. Do not use the Ingest API for constant or large-scale data transfer (e.g. sending large amounts of data that cover general error types or a large portion of customer transactions). If New Relic data ingestion by an application increases beyond an amount that WPVIP considers acceptable, access will be blocked.
Last updated: January 01, 2025