ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzatz_5.4.0.1/51/program/jraseti.htm

52 lines
1.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>Set up for integrated JRas operation</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h6><a name="jraseti"></a>Set up for integrated JRas operation</h6>
<p>In the integrated mode of operation, message and trace events are sent to WebSphere Application Server - Express logs. This is the default mode of operation. </p>
<ol>
<li>Import the requisite JRas extensions classes:
<pre>
import com.ibm.ras.*;
import com.ibm.websphere.ras.*;
</pre>
</li>
<li>Declare logger references:
<pre>
private RASMessageLogger msgLogger = null;
private RASTraceLogger trcLogger = null;
</pre>
</li>
<li>Obtain a reference to the Manager and create the loggers.
<p>Since loggers are named singletons, you can do this in a variety of places. One logical candidate for servlets is the servlet init() method. For example, for the servlet named &quot;myTestServlet&quot;, place the following code in the servlet init() method.</p>
<pre>
com.ibm.websphere.ras.Manager mgr = com.ibm.websphere.ras.Manager.getManager();
msgLogger = mgr.createRASMessageLogger(&quot;Acme&quot;, &quot;WidgetCounter&quot;, &quot;RasTest&quot;,
myTestServlet.class.getName());
// Configure the message logger to use the message file created for this application.
msgLogger.setMessageFile(&quot;acme.widgets.DefaultMessages&quot;);
trcLogger = mgr.createRASTraceLogger(&quot;Acme&quot;, &quot;Widgets&quot;, &quot;RasTest&quot;,
myTestServlet.class.getName);
mgr.addLoggerToGroup(trcLogger, groupName);
</pre>
</li>
</ol>
</body>
</html>