Help APM APM Insight using .NET Agent Track exceptions from custom loggers

Track exceptions from custom loggers

In general, APM Insight .NET agent instruments third-party loggers like log4net, NLog, Serilog, and more to track the exceptions logged by applications. We can also track the exceptions logged by the user's own application logger used in the application. To do this, follow the steps below. 

Steps to configure:

  1. Install APM Insight .NET agent.
  2. Navigate to the path C:\ProgramData\DotNetAgent.
  3. Open the XML config file custom_logger_instrumentation.xml in a text editor.
  4. Enter the parameters as per the below given syntax:
<site24x7 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<loggers>
<loggerMatcher className="Namespace.ClassName" methodName="MethodName" paramCount="Number_of_Parameters" severity="severity_level" paramIndex="Position_of_parameter_in_method" />
</loggers>
</site24x7>
 
Attribute Name Description
className The full name of the logger class with the namespace.
methodName The logger method to log the exception object.
paramCount The number of parameters passed in the logger method to differentiate when it has method overloading.
severity The severity of exceptions that are "fatal" or "warning." The default value is "fatal."
paramIndex The index value of an exception object in the method parameters. For example, if it is the first parameter, the value will be 0.

 

  1. After providing the logger configuration, save the file, and restart the application.
  2. Perform the specific transactions; the agent will capture the exceptions logged by the application.

Example:

Input:

<site24x7 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<loggers>
<loggerMatcher className="MyApplication.ExceptionLogger" methodName="Error" paramCount="1" severity="fatal" paramIndex="0" />
</loggers>
</site24x7>

Output:

 

Was this document helpful?
Thanks for taking the time to share your feedback. We’ll use your feedback to improve our online help resources.

Help APM APM Insight using .NET Agent Track exceptions from custom loggers