alternative use commons logging - STEMLab/geotools GitHub Wiki

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

Description

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.

Status

This proposal is under construction.

Voting has not started yet:

Tasks

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

        | :white_check_mark: | :no_entry: | :warning:               | :negative_squared_cross_mark: |

------------|--------------------|------------|-------------------------|-------------------------------| no progress | done | impeded | 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

BEFORE

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");
if(LOGGER.isLoggable(Level.WARNING))
  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);

AFTER

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

LOGGER.debug("bla bla");
LOGGER.trace("bla bla bla");
if(LOGGER.isWarningEnabled())
  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