Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{float:side=right}{panel:title=Contents|borderStyle=solid|borderColor=black}{toc:minLevel=1|maxLevel=3}{panel}{float}
{column}
h1. Exception sensor

The Exception sensor is used to gather information about exceptions in an application. The Exception Tracer is able to trace created, thrown, and handled exceptions within a target application. The Exception Tracer gathers information about *methods* and *constructors{*}that can cause an Exception. It must be specified which classes should be instrumented. There can be as many Exception Tracer configurations defined as you like.

h2. Configuration


To enable the Exception Tracer, the name together with the fully-qualified-name of the class to instrument must be defined. As an optional parameter it is possible to enable superclass or interface matching support. The Exception sensor name must always be defined as *exception-sensor{*}in the configuration file, so there is no need to write down the fully-qualified name of this sensor type. There is no limit in how many{_}exception-sensor_ configurations can be defined. When defining multiple _exception-sensor_ lines, there is always only one Exception Tracer created, which has one or more configurations.

{code}exception-sensor [Exception Class] [options]
{code}

{tip} In contrast to method sensor types where the definition will provide the name of the class/method on which the sensor is to be applied, the exception sensor needs the name of the Exception class that should be traced.  {tip}
The exception sensor is able to use Wildcards (see [ARCHIVE:Agent configuration]) for the definition of the class name. The options can be used to define that the provided exception class should be treated as interface or superclass (see the superclasses and interfaces chapter in [ARCHIVE:Agent configuration]).

h4. Examples

The next table provides samples of how the exception tracer can be used. Bear in mind, that you can define multiple exception-sensors.
|| Configuration \\ || Description ||
| exception-sensor java.lang.Throwable superclass=true | Classes are instrumented that directly or indirectly extend _java.lang.Throwable_. The class _java.lang.Throwable_ itself is *not* instrumented. |
| exception-sensor my.package.exception.MyException | Only the class _my.package.exception.MyException_ is instrumented. |
| exception-sensor my.package.ex*.*Exception | All classes are instrumented that match the pattern (like _my.package.exception.ParserException_ and _my.package.extension.ExtensionException_). |
| exception-sensor my.package.exception.IException interface=true | All classes are instrumented that are implementing the interface _my.package.exception.IException_. |
| exception-sensor my.package.exception.My*Exception | Classes like _my.package.exception.MyException_ and _my.package.exception.MyTestException_ are instrumented. |
| exception-sensor * | Every class of type _Throwable_ is instrumented. |
| exception-sensor my.pack*.ex*.\* superclass=true | Classes are instrumented which are extending the class that matches the pattern my.pack*.ex*.\* |