Trace Migration

This topic introduces how you can migrate BTT version 5.2 trace to BTT version 6.1 trace.

The original trace API of BTT version 5.2 can be still used in BTT version 6.1. BTT version 6.1 trace facility can automatically map the old API to the new API of BTT version 6.1 trace facility. BTT version 6.1 traces by package, but the original trace is by the Component ID in BTT version 5.2. BTT version 5.2 trace can trace to multiple targets at the same time, but BTT version 6.1 supports tracing to one target at the same time only when the BTTLogFactoryImplementClass is set.

The implementation of trace to File is changed to using Java™ util API, so the original parameter of trace to File is not supported in BTT version 6.1. The original function and implementation of trace to Display is kept in BTT version 6.1, so the parameter for trace to Display is still supported.

The original ‘HML’ trace level is not supported in BTT version 6.1. The original trace type is mapped to a new trace level. See the following table.
Table 1. Trace level map
BTT 6.1 trace level BTT 5.2 trace type WAS trace level Common logging Log4J
FATAL Severe Fatal Fatal Fatal
ERROR Error Severe Error Error
WARN Warning Warning Warn Warn
INFO Information Display Info Info Info
DEBUG Debug AllTypes Detail* Debug Debug
An example of Migrating BTT version 5.2 trace to BTT version 6.1 trace is as follows:
BTT version 5.2 trace configuration
<kColl id="traces">
    <field id="initializer" value="com.ibm.btt.base.TraceInitializer" />
    <field id="traceToFile" value="yes" />
    <field id="traceToDisplay" value="yes" />
    <field id="traceToWAS" value="yes" />
    <field id="traceWindowTitle" value="Server Trace" />
    <field id="showOriginator" value="yes" />
    <field id="showWarningMessage" value="no" />
    <field id="traceLevels" value="debug" />
    <field id="traceFileName" value="C:\dse\dselog.txt" />
    <field id="traceMaxLogFiles" value="5" />
    <field id="font" value="monospaced" />
    <field id="createBackup" value="yes" />
    <field id="fileNumberOfLines" value="4000" />
    <field id="displayNumberOfLines" value="2000" />
    <field id="linesOfBuffer" value="7000" />
    <field id="lineLength" value="200" />

    <kColl id="requestersComponents">
      <traceRequester id="#CHA" trace="yes" traceLevels="HML" traceTypes="FATAL" />
      <traceRequester id="#CS" trace="yes" traceLevels="HML" traceTypes="DEBUG" />
    </kColl>
</kColl>
BTT version 6.1 trace configuration after migration
<kColl id="traces">
    <field id="initializer" value="com.ibm.btt.base.TraceInitializer" />
    <field id="traceTargetFactoryImplClass" value="com.ibm.btt.base.BTTLogFactoryToDisplayImp" />
    <field id="displayNumberOfLines" value="2000" />
    <kColl id="requestersComponents">
      <traceRequester id="com.ibm.btt.base.*" trace="yes" traceLevels="FATAL" />
      <traceRequester id="com.ibm.btt.channel.*" trace="yes" traceLevels="DEBUG" />
    </kColl>
</kColl>
BTT version 5.2 trace application code
if (Trace.doTrace(Constants.CHACOMPID,Trace.High,Trace.Debug))
    Trace.trace(Constants.CHACOMPID,Trace.High,Trace.Debug,Settings.getTID()," CHA Debug .........");
if (Trace.doTrace(Constants.CHACOMPID,Trace.High,Trace.Information))
    Trace.trace(Constants.CHACOMPID,Trace.High,Trace.Information,Settings.getTID(),"CHA info .........");
BTT version 6.1 trace application code after migration
BTTLog   log=BTTLogFactory.getLog(“com.ibm.btt.base.LocalContextImp”);
If (log.doDebug())
  log.debug(“CHA Debug……”);
If (log.doInfo())
  log.info(“CHA info……”);