You can configure JRas operations to output trace data and logging messages to only user-defined locations.
The JRas framework described in this task and its sub-tasks is deprecated. However, you can achieve similar results using Java logging.
In stand-alone mode, messages and traces are logged only to user-defined logs. The following sample assumes that:
import com.ibm.ras.*; import com.ibm.websphere.ras.*;
import com.ibm.ws.ras.test.user.*;
private RASMessageLogger msgLogger = null; private RASTraceLogger trcLogger = null;
com.ibm.websphere.ras.Manager mgr = com.ibm.websphere.ras.Manager.getManager(); msgLogger = mgr.createRASMessageLogger("Acme", "WidgetCounter", "RasTest", myTestBean.class.getName()); // Configure the message logger to use the message file that is defined in //the ResourceBundle sample. msgLogger.setMessageFile("acme.widgets.DefaultMessages"); // Get a reference to the Handler and remove it from the logger. RASIHandler aHandler = null; Enumeration enum = msgLogger.getHandlers(); while (enum.hasMoreElements()) { aHandler = (RASIHandler)enum.nextElement(); if (aHandler instanceof WsHandler) msgLogger.removeHandler(wsHandler); } // Create the user handler and formatter. Configure the formatter, // then add it to the handler. RASIHandler handler = new SimpleFileHandler("myHandler", "FileName"); RASIFormatter formatter = new SimpleFormatter("simple formatter"); formatter.addEventClass("com.ibm.ras.RASMessageEvent"); handler.addFormatter(formatter); // Add the Handler to the logger. Add the logger to the list of the // handlers listeners, then set the handlers // mask, which will update the loggers composite mask appropriately. // WARNING - there is an order dependency here that must be followed. msgLogger.addHandler(handler); handler.addMaskChangeListener(msgLogger); handler.setMessageMask(RASIMessageEvent.DEFAULT_MESSAGE_MASK);
Searchable topic ID: ttrb_jrasalone