Reputation: 2434
I am currently using New Relic for my .NET application hosted in Azure and in the New Relic UI I can see all uncaught exceptions that occur in my web app. What I would like to be able to do is log ALL messages and caught exceptions as well so that I can see them in New relic UI alongside the uncaught exceptions (that I currently see now). Has anyone ever done this before and if so can you provide a how-to or maybe some code for how you got this working?
I haven't been able to find much about this online except for making using the 'NoticeError' API call somehow. Is this the right approach or is there another way to accomplish this?
Upvotes: 3
Views: 1755
Reputation: 2434
After contacting New Relic support I found out the following:
Therefore you can configure the NoticeError API call to log the highest level exception that gets thrown or a single error message string per web service or page request.
This error will then show-up in the New Relic UI under the Errors section within the Events tab.
Upvotes: 4
Reputation: 30903
NewRelic is not logging facility! It is monitoring/analyzing facility. You have to shape your logging on your own. Using any logging framework you are familiar with, or creating your own.
I personally use a wrapper around the System.Diagnostics.Trace's static methods WriteLine, TraceError, TraceWarning. Then I have them automatically transferred by the Azure Diagnostics monitor. I would not raise an exception just to log something.
Upvotes: 1