Writing a trace message
You use the trace method of the
LogUtils
class to generate a trace message. This
method has two signatures. One of them is informational. The other is associated
with an exception.
void trace
(Level l, String classname, String method, String msg)
void trace
(Level l, String classname, String method, String msg, Exception ex)
In an outbound or inbound scenario, to get the
LogUtils
object instance, in
WebSphere Integration Developer, Right click on the method and select the
following option:
v
Source
→
Insert Trace Statement
In an outbound scenario, you can use the logger property as a consistent way to
get a log object to write log or trace messages into log or trace files.
Trace messages might contain data from the customer’s EIS. Because a customer
might be unwilling to send a trace file that contains sensitive data to a support
specialist for analysis, you can optionally use the traceConfidential method of the
LogUtils
class to write confidential trace messages whose EIS-specific content is
replaced by a string of XXX’s when the customer enables the
HideConfidentialTrace property. Like the trace method, the traceConfidential
method has two signatures. One of them is informational. The other is associated
with an exception.
void traceConfidential
(Level l, String classname, String method, String msg, Object[] confidentialData)
void traceConfidential
(Level l, String classname, String method, String msg, Object[] confidentialData, Exception e)
Example of informational trace message
getLogUtils().trace
(Level.Fine, "FooAdapter", "openConnect", "Successfully connected to Foo server");
Example of exception trace message
getLogUtils().trace(Level.Finer, "FooAdapter", "closeConnection",
"While attempting to close the connection to Foo server,
Foo API reported that the server had already closed the connection
previously due to inactivity.
Ignoring because connection was closed all the same",
fooAPIException);
Example of trace message for the outbound scenario
public HelloWorldConnectionFactory(ConnectionManager connMgr, WBIManagedConnectionFactory mcf)
{
super(connMgr, mcf);
getLogUtils().trace(Level.FINE,"com.ibm.helloworld.outbound.HelloWorldConnectionFactory",
"HelloWorldConnectionFactory()", "test");
}
Example of trace message for the inbound scenario
public javax.resource.cci.Record getRecordForEvent(
com.ibm.j2ca.extension.eventmanagement.Event event
)
throws javax.resource.ResourceException,
javax.resource.spi.CommException {
logger.trace(Level.FINE,
"com.ibm.helloworld.inbound.HelloWorldEventStoreWithXid",
176
WebSphere Adapters: WebSphere Adapter Toolkit User Guide
Summary of Contents for WebSphere Adapters
Page 2: ......
Page 6: ...iv WebSphere Adapters WebSphere Adapter Toolkit User Guide...
Page 220: ...214 WebSphere Adapters WebSphere Adapter Toolkit User Guide...
Page 224: ...218 WebSphere Adapters WebSphere Adapter Toolkit User Guide...
Page 225: ......
Page 226: ...Printed in USA...