The wrapper.filter pair of properties make it possible to filter
the output of a JVM and then perform some action whenever a
specific trigger string is found. The filtering process works by
comparing JVM console output against registered triggers until a
match is found. At that point the associated action is executed.
Only the first matching trigger will be handled for any line of
output. Each trigger/action pair ends with an integer number
counting up from 1. There can be no missing numbers. If an action
is omitted, it will default to
RESTART.
The trigger can be any string. Possible actions are
RESTART,
SHUTDOWN, and
NONE.
RESTART will stop the current
JVM and then restart a new invocation.
SHUTDOWN will stop the JVM as
well as the Wrapper. NONE is
useful because it will prevent any triggers with a higher number
from being triggered.
The following example will monitor the JVM output and then restart
the JVM automatically whenever a
java.lang.OutOfMemoryError is
thrown to the console. Depending on where in an application the
error is thrown, it is not always possible to trap and handle the
error in a useful way from within the JVM.
Filters work by monitoring the console output of the JVM. In order
for a trigger to be fired by an exception, the Java application
must print the message being filtered to the console.
Example: |
wrapper.filter.trigger.1=java.lang.OutOfMemoryError
wrapper.filter.action.1=RESTART
|
The next example demonstrates how to trigger a JVM restart whenever
the string Error appears anywhere
in the output, with the exception of the case where the string is
part of the larger string IgnoreError.
Example: |
wrapper.filter.trigger.1=IgnoreError
wrapper.filter.action.1=NONE
wrapper.filter.trigger.2=Error
wrapper.filter.action.2=RESTART
|
The string being filtered can contain spaces. But due to the way the
configuration properties are loaded in general, any leading of trailing
spaces will be trimmed when the property is loaded.
Example: |
wrapper.filter.trigger.1=Restart me now.
wrapper.filter.action.1=RESTART
|
|