WAS v8.5 > Troubleshoot > Add logging and tracing to the applicationConfigure applications to use Jakarta Commons Logging
Jakarta Commons Logging provides a simple logging interface and thin wrappers for several logging systems. WebSphere Application Server supports Jakarta Commons Logging by providing a logger. The support does not change interfaces defined by Jakarta Commons Logging.
The WAS logger is a thin wrapper for the WAS logging facility. The logger name is com.ibm.websphere.commons.logging.WsJDK14Logger. The logger can handle logging objects defined by either of the following:
- Java Logging found in Java Specification Request 47: Logging API Specification
- Common Base Event
A logging object is an object that holds logging entry information.
To better understand Jakarta Commons Logging, read Jakarta Commons and the specifications for Java Logging and for Common Base Event. To better understand use of the WAS logger, read Jakarta Commons Logging. WAS provides the Jakarta Commons Logging binary distribution in its libraries directory. By default, the product uses the Jakarta Commons Logging LogFactory implementation and JDK14Logger.
Best practice: The default configuration of Jakarta Commons Logging is stored in the commons-logging.properties file. To specify the factory class to use with Jakarta Commons Logging in an application, provide a file named org.apache.commons.logging.LogFactory, located in META-INF/services directory, containing the name of the factory class on the first line. This is the configuration mechanism for the JAR file service provider, as defined in JDK 1.3 and above.best-practices
For an application to use the WAS logger, the application must provide its own configuration for the logger. To configure an application to use the WAS logger, complete the steps that follow.
- Examine Configurations for the WAS logger and determine which configuration best suits the application.
- Change the application configuration as needed to enable use of the WAS logger.
Results
After the application starts, Jakarta Commons Logging routes the application's logging output to the WAS logger.
Subtopics
- Jakarta Commons Logging
Jakarta Commons Logging provides a simple logging interface and thin wrappers for several logging systems. The logging interface enables application logging to be simple and independent of the logging system the application uses. We can change the logging implementation for a deployed application without having to change the application logging code. However, the simplicity of the logging interface prevents the application from leveraging all the functionality of the logging systems.- Configurations for the WAS logger
This topic describes several ways to configure an application to use the WAS logger.
Related concepts:
Jakarta Commons Logging
Configurations for the WAS logger
Related
Add logging and tracing to the application
Related information:
JSR 47: Logging API Specification
Specification: Common Base Event
Standardize messages with the Common Base Event model
Logging/Containers And Classloaders