Runtime components : Runtime Tools : Trace Facility : Tasks : Using trace
  
Using trace
Following is the trace configuration example:
<kColl id="traces">
<field id="initializer" value="com.ibm.btt.base.TraceInitializer"/>
<field id="traceTargetFactoryImplClass" value="com.ibm.btt.base.BTTLogFactoryToWASImp" />
<kColl id="requestersComponents">
<traceRequester id="com.ibm.btt.*" trace="yes" traceLevels="INFO"/>
<traceRequester id="com.ibm.btt.base.*" trace="no" traceLevels="ERROR" />
<traceRequester id="com.ibm.btt.base.ContextFactory" trace="yes" traceLevels="DEBUG"/>
</kColl>
</kColl>
Following is the code example of trace usage:
package com.ibm.btt.test;
public class TraceTestSample{
private static BTTLog log=BTTLogFactory.getLog(TraceTestSample.class.getName());
………
private void myMethod(){…
if (log.doDebug())
log.entry();
……
if (log.doInfo())
log.info(“information message…”);
if (log. doDebug ())
log.debug(“debug message…”);
……
if (returnCode!=OK){
if (log. doError ())
log.error(“error when sendReceive, errorCode=”+returnCode);
}
……
if (log. doDebug ())
log.exit();
}
}
Go up to
Tasks