Apache Commons Logging Explained

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]

Log level

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.

LevelDescription
fatalSevere errors that cause premature termination. Expect these to be immediately visible on a status console.
errorOther runtime errors or unexpected conditions. Expect these to be immediately visible on a status console.
warnUse 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.
infoInteresting runtime events (startup/shutdown). Expect these to be immediately visible on a console, so be conservative and keep to a minimum.
debugDetailed information on the flow through the system. Expect these to be written to logs only.
traceMost detailed information. Expect these to be written to logs only.
[3] [4]

Configuration

Two basic abstractions, Log and LogFactory, are used in Apache Commons Logging.[3]

Example

Sample code may look like as follows:package com.cascadetg.ch09;

import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.apache.commons.logging.impl.Jdk14Logger;

public class LogGenerator[4]

See also

Notes and References

  1. Web site: commons logging. 12 February 2016. Apache.org. Apache.
  2. Book: Zavala, D.A.. Integrating Jakarta Commons Logging with IBM WebSphere Application Server V5. Lau. Y.C.. IBM corporation. 2004. 2.
  3. Web site: contents. 12 February 2016. Apache.org. Apache.
  4. Book: Iverson, W.. Apache Jakarta Commons - Reusable Java Components. Pearson Education, Inc.. 2005. Crawfordsville, Indiana, USA. 120–122.