Help Docs

Track exceptions via .NET agent API

The .NET agent API helps in keeping track of exceptions handled in .NET and .NET Core applications. To track handled exceptions, it must be called inside the catch block.

The APM Insight .NET agent tracks a few logging providers by default, including log4net, NLog, and Serilog. On the other hand, the APM Insight agent profiler will not know the signature of your application methods if you use your own logging framework. In such cases, you can use .NET agent API to track the exceptions.


  1. Install APM Insight .NET agent or APM Insight .NET Core agent based on your application environment.
  2. Download or reference the package Site24x7.Agent.Api from the NuGet package manager to your application project.
    Note: The API has a class named Site24x7.Agent.Api  to track the performance of application code.
  3. Use the method TraceError(Exception exceptionObject)  to track any exception in a transaction.

Parameter Name



The exception object  that you want to track.


The following method illustrates how to track an exception via API.

public int UserLogin()
                    MyClass myClass = ;
                    int b = 0;
                    int invalidResult = a / b;
          catch (Exception ex)

To View:

Was this document helpful?

Would you like to help us improve our documents? Tell us what you think we could do better.

We're sorry to hear that you're not satisfied with the document. We'd love to learn what we could do to improve the experience.

Thanks for taking the time to share your feedback. We'll use your feedback to improve our online help resources.

Shortlink has been copied!