Apache Commons Logging | |
Developer: | Apache Software Foundation |
Latest Release Version: | 1.3.3 |
Operating System: | Cross-platform |
Programming Language: | Java |
Genre: | Logging Tool |
License: | Apache License 2.0 |
Apache Commons Logging (previously known as Jakarta Commons Logging or JCL) is a Java-based logging utility and a programming model for logging and for other toolkits. It provides APIs, log implementations, and wrapper implementations over some other tools.[1] [2] [3]
The following table defines the log levels and messages in Apache Commons Logging, in decreasing order of severity. The left column lists the log level designation in and the right column provides a brief description of each log level.
Level | Description | |
---|---|---|
fatal | Severe errors that cause premature termination. Expect these to be immediately visible on a status console. | |
error | Other runtime errors or unexpected conditions. Expect these to be immediately visible on a status console. | |
warn | Use of deprecated APIs, poor use of API, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong". Expect these to be immediately visible on a status console. | |
info | Interesting runtime events (startup/shutdown). Expect these to be immediately visible on a console, so be conservative and keep to a minimum. | |
debug | Detailed information on the flow through the system. Expect these to be written to logs only. | |
trace | Most detailed information. Expect these to be written to logs only. |
Two basic abstractions, Log and LogFactory, are used in Apache Commons Logging.[3]
Sample code may look like as follows:
import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.commons.logging.impl.Jdk14Logger;
public class LogGenerator[4]