Configuring tracing and logging for features in Liberty
You can use the tracing and logging mechanism of Liberty for Liberty features. The logging service is part of the Liberty kernel so you do not have to specify a feature in your server.xml file to use it.
About this task
Liberty provides the following SPIs for
integrating tracing and logging in your customized feature code:
com.ibm.websphere.ras
- The
com.ibm.websphere.ras
package provides classes to log messages and trace records, as well as some extension points. In general,, feature code can use thejava.util.logging
package to log trace and messages, and to control the output through Liberty logging configuration, but the extended capability of the WebSphere® package is sometimes useful and the trace guards are slightly more efficient when trace is disabled. com.ibm.websphere.ras.annotations
- The
com.ibm.websphere.ras.annotations
package provides annotations for use with classes in the other packages. For example, an@Sensitive
annotation can be used to prevent the contents of the annotated variable from appearing in trace or message output. com.ibm.ws.ffdc
- The
com.ibm.ws.ffdc
package provides facilities to write first failure data capture (FFDC) records to assist in debugging unexpected exceptions. com.ibm.wsspi.logging
- The
com.ibm.wsspi.logging
package provides interception points of log and ffdc records.
The Java™ API documentation for each Liberty SPI is available in a separate .zip file in one of the javadoc subdirectories of the ${wlp.install.dir}/dev directory.
Procedure
The following steps show you how to configure an example Liberty feature, called
myfeature
, to use the tracing and logging mechanism of Liberty: