Personal tools
gvSIG Desktop
gvSIG Desktop

Cached time 11/21/13 17:02:30 Clear cache and reload

 

The logging API to use in gvSIG 2.0 is the SLF4J library. If the project being migrated is using another logging API, such as Log4J or java.util.logging, then it needs to be replaced with the SLF4J logging API. You can find more information on SLF4J in the section on logging in the development guide

In general, the steps needed to migrate from Log4J to SLF4J are:

1.- Replace the Log4J import classes with those of SLF4J:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// substituting the import of Log4j ...
// import org.apache.log4j.Logger;

2.- Change the Logger definition:

private static final Logger LOG = Logger.getLogger(MyClasser.class);
...

To:

private static final Logger LOG = LoggerFactory.getLogger(MyClass.class);
...

3.- Use message parameters where appropriate. For example:

LOG.debug("Point values: X = " + point.getX() + ", Y = " + point.getY());
...

To:

LOG.debug("Point values: X = {}, Y = {}", point.getX(), point.getY());
...

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: