Using Trace Objects
You use the trace objects com.sap.tc.logging.Category and com.sap.tc.logging.Location to access log and trace mechanisms.
All trace objects read their configuration information from the Log Configurator.
More information: Log Configurator Service
In the example adapter, access to the logging API is completely wrapped in the XITrace class.
● Open XITrace.java.
If you are migrating an older adapter version, you can also can also apply this class in your project.
XITRace implements XI AF Tracing API. Instantiate the TRACE object as follows:
○ XITrace TRACE = new XITrace(SPIManagedConnectionFactory.class.getName());
instead of:
○ TRACE = new Trace(<your version string>);
All trace objects read their configuration information from the Log Configurator service. The settings are updated once a minute. Therefore, the trace object takes at most one minute to react to any possible changes.
● If the trace object constructor is called, then the location for which the trace object writes traces and logs must be specified in the version parameter by the caller. It is called this.getClass().getName().
● Note the following rules for code instrumentation:
○ Logging
■ Determine all information that might be interesting for a system administrator.
■ Set fatalT(), warningT(), and errorT() wherever an error can affect the system.
■ To document successful processing in the adapter, set infoT() (for example, adapter started, message processed successfully, and so on).
■ Only use debugT() restrictively.
○ Tracing
Use entering(), exiting(), throwing() and catching()throughout the adapter code, particularly in the message processing area. The trace is used by SAP Support to determine the location and cause of the error.