This component calls
SuicideService.die if any logging
client logs an ERROR or FATAL string.
This optional component is useful in deployed or automated
environments, where any error should kill the node. For example,
an exception thrown during a component's load may result in a
partially configured (broken) node, in which case a nightly
testing script would likely want a quick "System.exit" instead
of waiting forever.
To load, add the following XML to your node definition:
<component
class='org.cougaar.core.logging.DieOnErrorComponent'
priority='HIGH'
insertionpoint='Node.AgentManager.Agent.Component'/>
To enable the "System.exit(..)", which is disabled by
default, add the following system property:
<vm_parameter>
-Dorg.cougaar.core.service.SuicideService.enable=true
</vm_parameter>
Note that the optional ACME
org.cougaar.util.log.log4j.SocketAppender will redirect
java.lang.System.err output to an ERROR log, so users may
want to change this to WARN logging by setting:
<vm_parameter>
-Dorg.cougaar.util.log.log4j.stderrLogLevel=WARN
</vm_parameter>
Some of the alternate design options that were considered:
- A binder around LoggingService clients, but this would miss
the static logger clients.
- A Log4J appender defined in the "loggingConfig.conf" properties
file. However, it would be awkward to set the SuicideService
in the appender, which would likely require assistance from a
Cougaar component. The advantage of the appender-based design
would be the ability to filter out ERRORs for specific log
categories (e.g. ignore errors from "org.foo").
|