A simple logging abstraction wrapping log4j and other logging frameworks.

The org.apache.commons.httpclient.log package provides a simple abstraction of log4j and similiar logging frameworks.

Using this abstraction allows HTTP Client to seamlessly support log4j and other frameworks without introducing a run-time dependency on them.

Note: This package is likely to be revised or replaced in the near future in order to use the similiar abstraction being considered within Log4J itself.

Absent any specific configuration settings, this logging abstraction will provide the following behaviour:

  1. If Log4J is in your classpath (specifically, if the org.apache.log4j.Category class is in your classpath), then the {@link org.apache.commons.httpclient.log.Log4JCategoryLog Log4JCategoryLog} {@link org.apache.commons.httpclient.log.Log Log} implementation will be used for logging. In this case you may use and configure the HTTP Client logging in precisely the same way as any other Log4J client. The log4j.properties.sample file in the distribution provides an example of one such configuration.
  2. Otherwise, the {@link org.apache.commons.httpclient.log.NoOpLog NoOpLog} {@link org.apache.commons.httpclient.log.Log Log} implementation will be used for logging. In this case, no log output will be generated by HTTP Client.

One may (but need not) provide a Java system property named httpclient.log that contains the full-specified name of a class implementing {@link org.apache.commons.httpclient.log.Log Log} in order to use an alternative logging framework. {@link org.apache.commons.httpclient.log.SimpleLog SimpleLog} is one such example, providing a subset of Log4J-like functionality, but only to the standard output stream. See the simplelog.properties.sample file in the distribution for details on configuring the SimpleLog.