Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Reporting Java Application errors to NR

rfb

#1

I’m Using Java New Relic Agent v3.38.0 with IBM Java 8 & IBM Liberty v8.5.5.9. The newrelic config file newrelic.yml is largely unchanged.

The Java application is not a Web-based application but a quartz scheduled job which pops messages from a Queue and posts messages to other backend systems (REST based). Log4j is used to log info/errors etc
Occasionally there are application errors - e.g. back end system is not responding, credentials to backend system have become invalid, there have been JSON model changes and Java exceptions are occurring…
when an application error occurs, I need to know about the error.

Question - How can I get to see Java Exception details reported to NewRelic (as errors)? - then I can create a policy based on the error to result in a notification.

Currently there is no API calls the NewRelic Java Agent - my understanding is that the NewRelic Java Agent would report exceptions to NewRelic but I’m not seeing any despite exceptions occurring - where do I look for these on the NewRelic dashboard?


#2

Hi Garret,

The New Relic Java agent does allow you to use an API (the noticeError API) to capture even the exceptions handled by your application and report them to the New Relic APM dashboard.

I encourage you to please go through the instructions provided in the link below on how to use the noticeError API.

https://docs.newrelic.com/docs/agents/java-agent/configuration/java-agent-error-configuration#error-configuration

Here is an example where noticeError method is used:

https://docs.newrelic.com/docs/agents/java-agent/custom-instrumentation/java-agent-api-example-program#control-handler

Do let me know if the information I provided was helpful or if you’re looking for something else.

Kind Regards,
Silas.
Tech Support Engineer,
New Relic.


#3

Hi Silas,

Could you please tell me how to I report error to different environments. How exactly i can provide the account details?


#4

Hi, @dsama: I am not sure I understand your question. When you deploy New Relic for an application, you provide the license key for your account. Any errors reported by that application will go to the account associated with that license key.

If you have different environments, such as production, dev, staging, etc., you should deploy each environment as a separate application:


#5

Thank you for quick response. I am using NewRelic.noticeError to report error and would like to test this from local environment. Should what is that i should pass to this API to point to a correct environment.


#6

I still do not understand your question. noticeError() accepts an exception object or error message; it does not know (or care) about your environment. It will report the error to your New Relic application; the application will report to the New Relic account whose license key is in the agent configuration file.

Are you saying that you want run New Relic locally, without sending data to the cloud? That is not possible; New Relic is only available as a cloud-based service.


#7

I guess he’s just trying to test from local development env the noticeError method, and probably just wants to check how this error show up in NR Dashboard (before deploying code changes to any other env).