Analyze exceptions and log messages

Goal of this tutorial

To explain how to use AppMon to diagnose the root cause of exceptions and error log messages.

Scenario

Use the easyTravel demo application, or your own application to learn how to handle exceptions and log messages.

Requirements

or
  • Your own instrumented application.
  • AppMon with System Profile for your app.

Procedure

1. Prepare the application

If you're using easyTravel you may skip this part.

1.1 Exceptions capture settings

To enable exceptions capture:

  1. Open the System Profile Preferences dialog box and go to the Sensor Configuration item of the required Agent Group.
  2. Find the Exceptions or .NET Exceptions sensor, and double-click it for editing.
  3. There are two ways to handle exceptions capture:
    • Capture everything, and skip specified exceptions.
    • Capture specified exceptions, and skip everything else. Select the required option, and specify classes to be captured/excluded. You can do it manually, or use Class Browser. See Java Exception sensor and .NET Exception sensor for more information.
Exceptions capture settings
Exceptions capture settings

1.2 Log capture settings

AppMon logging captures errors and warnings. You can also enable capture of DEBUG messages.

Warning

DEBUG logging captures can cause considerable overhead in your application.

  1. Open the System Profile Preferences dialog box and go to the Sensor Configuration item of the required Agent Group.
  2. Find the Java Logging or .NET Logging sensor, and double-click it for editing.
  3. There are two ways to handle log capture:
    • Capture everything, and skip specified messages.
    • Capture specified messages, and skip everything else. Select the required option, and specify messages to be captured/excluded. See Java Logging sensor and .NET Logging sensor for more information.
Log capture settings
Log capture settings

1.3 Errors capture settings

AppMon detects errors in your application with a configurable set of error detection rules. These rules are based on exceptions, HTTP response codes, and log messages. AppMon counts errors by transaction. The node that triggers the error is marked in the PurePath. Optionally, the transactions are marked as failed. The System Profile dictates the configuration for error detection rules. These rules are for common problems in applications, like unhandled exceptions that are outside of the transaction scope, or HTTP 500 responses. See System Profile - Error Detection for information about configuring error detection rules.

Error detection settings
Error detection settings

2. Monitor the application

2.1 Overview functional health

For an overview of the functional health of your application, use the Functional Health dashlet. You can see how the transaction's load and failure rate compare to another time frame.

Functional health dashlet
Functional health dashlet

2.2 Overview errors

For an overview of errors within a certain time frame, use Errors dashlet.

Errors dashlet
Errors dashlet

The Errors dashlet includes the following:

  • The upper, Error Overview pane: Details errors and their occurrences.
  • The lower, Error Details pane: Details the exception class and message for the group of error rules or a single rule, selected in the upper pane.

3. Identify problems

3.1 Identify exceptions root cause

Use the Exceptions dashlet. To view all the exceptions found in the PurePaths of your session. You can see the exception class, message, which class threw the exceptions, and how often it occurs.

Exceptions dashlet
Exceptions dashlet

Right-click the exception and select Drill Down > PurePath to identify where the exception came from and why it did occur.

Drilldown to PurePath from the Exceptions dashlet
Drilldown to PurePath from the Exceptions dashlet

From here you can drill down to business transactions or web requests to identify the transaction that triggers the exception.

3.2 Identify the root cause of error logs

Identify the root cause the same way you identify exceptions. Use the Logging dashlet, and drill down from here.

4. Automatically capture PurePath on exception

It's not always possible to check exceptions immediately in production or load test environments. It's more efficient to automatically store a transaction. To do this follow these steps:

  1. In the Exceptions dashlet, right-click the required exception, and select Create Measures.
  2. Give it a meaningful name and save the measure. Create a measure based on exception
  3. Open the System Profile Preferences dialog box, and click Measures.
  4. Find for your new Measure, and double-click it for editing.
  5. Set the Upper Severe threshold to one. This will allow to raise an incident on the exception occurrence. Set threshold
  6. Now switch to the Incidents item of the System Profile Preferences dialog box, and click Create Incident Rule.
  7. Give it a meaningful name.
  8. At the Conditions tab, click Add, then find and select your newly created measure. Set threshold
  9. Switch to the Actions tab, right-click the table, and select Add.
  10. In the Rule Action pane, select Store Session Action Plugin.
  11. Configure the parameters as you need.
    Parameter Description
    Minutes Past How many minutes of data before the incident to be saved.
    Minutes Future How many minutes of data after the incident to be saved.
    Recording Option Data to be saved:
    • all: All session data from the defined timespan, including PurePaths, and chart data.
    • violations: Only failed PurePaths and related chart data form the defined timespan.
    • timeseries: All chart data from the defined timespan.
    Lock Session Locks the newly created stored session to prevent its deletion by automatic cleanup tasks. You can still delete the stored session manually.
    Append timestamp Adds timestamp of the creation time to the stored session as a label.
    Set action
  12. Save all the changes.

When an exception occurs, you receive an incident and you can drill down to the PurePaths. If the exception occurs multiple times, you receive a single incident with multiple PurePaths attached to it.