GeoTools : Alternative Use Commons Logging




Justin Deoliveira



Use commons logging across the board

This page represents a counter proposal to Allow redirection to alternate logging API.


The use of java logging hampers our ability to work in several environments; most notably application containers. The defacto standard in this case is for libraries to use the commons-logging API; which allows
for integration with several logging frameworks.


This proposal is under construction.

Voting has not started yet:

dynamictasklist: task list macros declared inside wiki-markup macros are not supported


This section is used to make sure your proposal is complete (did you remember documentation?) and has enough paid or volunteer time lined up to be a success


no progress






lack mandate/funds/time


volunteer needed

  1. depend on commons logging
  2. API changed based on BEFORE / AFTER
  3. Deprecate CommonLogger and Logging methods associated to it!
  4. Update developers guide

API Changes


This is a change in dependency only, as such it will effect client projects pom.xml.

import java.util.logging.logger;
private static final Logger LOGGER = Logger.getLogger("org.geotools.rendering");
LOGGER.fine("bla bla");
LOGGER.finer("bla bla bla");
  LOGGER.log(Level.WARNING, "oh my my", exception);
LOGGER.log("bla {0} bla {1}", new Oject[] {p1, p2});
LOGGER.logp(Level.FINE, "org.geotools.myClass", "myMethod", "bla bla);
LOGGER.logrb(Level.FINE, "org.geotools.myClass", "myMethod", "myResourceBundle", "bla bla);


import org.apache.commons.logging.*;
private static final Log LOGGER = LogFactory.getLogger("org.geotools.rendering");

LOGGER.debug("bla bla");
LOGGER.trace("bla bla bla");
  LOGGER.warning("oh my my", exception);
// parametrized logging is un-translatable
// logp in un-translatable to commons logging
// log4b is un-translatable to commons logging

Documentation Changes


Just a reminder: Commons-Logging is reputed to have ClassLoader problems [1]. According their JIRA task [2], Hibernate is moving away from Commons-Logging to SLF4J because of that. Jetty also moved from Commons-Logging (Jetty 5) to SLF4J (Jetty 6) [3], which is causing the trouble that Andrea reported to us and trigged this logging discussion.


However, we could said "use SLF4J" instead and this comment would not be applicable anymore. So I suggest to interpret this proposal as "Use SLF4J" (

Posted by desruisseaux at Oct 30, 2007 12:59