Migrate to SLF4J.

This commit is contained in:
Christian P. MOMON 2013-06-26 16:52:15 +02:00
parent 8bab4e893f
commit 2d65585627
14 changed files with 31 additions and 13 deletions

View file

@ -10,5 +10,7 @@
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/> <classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/junit-4.11.jar"/> <classpathentry kind="lib" path="lib/junit-4.11.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/> <classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/slf4j-api-1.7.5.jar"/>
<classpathentry kind="lib" path="lib/slf4j-log4j12-1.7.5.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Thu Jun 20 02:51:05 CEST 2013 #Wed Jun 26 14:05:55 CEST 2013
build.number=5 build.number=6

View file

@ -7,3 +7,5 @@ Description of used libraries:
- junit: unit tests API - junit: unit tests API
- log4j: log API - log4j: log API
- servlet-api: servlet API - servlet-api: servlet API
- slf4j-api: facade log API
- slf4j-log4j12: adaptation layer between slf4j and log4j

Binary file not shown.

BIN
lib/slf4j-api-1.7.5.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/slf4j-log4j12-1.7.5.jar Normal file

Binary file not shown.

View file

@ -4,12 +4,15 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
*/ */
public class CookieHelper public class CookieHelper
{ {
static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(CookieHelper.class); static private final Logger logger = LoggerFactory.getLogger(CookieHelper.class);
/** /**
* *

View file

@ -14,13 +14,16 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
*/ */
public class ServletDispatcher extends SimpleServletDispatcher public class ServletDispatcher extends SimpleServletDispatcher
{ {
private static final long serialVersionUID = -3471226305721330069L; private static final long serialVersionUID = -3471226305721330069L;
protected org.apache.log4j.Logger logger; static private Logger logger;
// protected Servlets servlets; // protected Servlets servlets;
@ -68,7 +71,7 @@ public class ServletDispatcher extends SimpleServletDispatcher
public void init() throws ServletException public void init() throws ServletException
{ {
super.init(); super.init();
this.logger = org.apache.log4j.Logger.getLogger(this.getClass()); logger = LoggerFactory.getLogger(this.getClass());
// this.servlets = new Servlets(); // this.servlets = new Servlets();
} }
} }

View file

@ -19,6 +19,9 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.util.StringList; import fr.devinsy.util.StringList;
/** /**
@ -27,7 +30,7 @@ import fr.devinsy.util.StringList;
public class SimpleServletDispatcher extends HttpServlet public class SimpleServletDispatcher extends HttpServlet
{ {
private static final long serialVersionUID = -3471226305721330069L; private static final long serialVersionUID = -3471226305721330069L;
static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ServletDispatcher.class); static private Logger logger = LoggerFactory.getLogger(ServletDispatcher.class);
static final protected Pattern SHORT_REWRITED_URL_CLASS = Pattern.compile("^([^-]+)-.+\\.xhtml$"); static final protected Pattern SHORT_REWRITED_URL_CLASS = Pattern.compile("^([^-]+)-.+\\.xhtml$");
static final protected Pattern SHORT_REWRITED_URL_PARAMETERS = Pattern.compile("^[^-]+-(.+)\\.xhtml$"); static final protected Pattern SHORT_REWRITED_URL_PARAMETERS = Pattern.compile("^[^-]+-(.+)\\.xhtml$");
@ -181,7 +184,7 @@ public class SimpleServletDispatcher extends HttpServlet
org.apache.log4j.BasicConfigurator.configure(); org.apache.log4j.BasicConfigurator.configure();
} }
logger = org.apache.log4j.Logger.getLogger(this.getClass()); logger = LoggerFactory.getLogger(this.getClass());
logger.info("Log initialization done."); logger.info("Log initialization done.");
} }
} }

View file

@ -9,8 +9,8 @@ import org.apache.commons.fileupload.FileItem;
*/ */
public class FileItemHelper public class FileItemHelper
{ {
// static private org.apache.log4j.Logger logger = // static private final Logger logger =
// org.apache.log4j.Logger.getLogger (FileItemHelper.class); // LoggerFactory.getLogger(FileItemHelper.class);
/** /**
* List FileItem * List FileItem

View file

@ -2,12 +2,15 @@ package fr.devinsy.util.web;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* *
*/ */
public class Redirector public class Redirector
{ {
static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Redirector.class); static private final Logger logger = LoggerFactory.getLogger(Redirector.class);
/** /**
* *

View file

@ -4,6 +4,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.kiss4web.CookieHelper; import fr.devinsy.kiss4web.CookieHelper;
@ -12,7 +14,7 @@ import fr.devinsy.kiss4web.CookieHelper;
*/ */
public class SimpleSecurityAgent public class SimpleSecurityAgent
{ {
static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(SimpleSecurityAgent.class); static private final Logger logger = LoggerFactory.getLogger(SimpleSecurityAgent.class);
final static public String USERID_LABEL = "securityAgent.userId"; final static public String USERID_LABEL = "securityAgent.userId";
final static public String ACCOUNTID_LABEL = "securityAgent.accountId"; final static public String ACCOUNTID_LABEL = "securityAgent.accountId";
final static public String AUTH_LABEL = "securityAgent.auth"; final static public String AUTH_LABEL = "securityAgent.auth";

View file

@ -7,7 +7,7 @@ import fr.devinsy.kiss4web.ServletDispatcher;
/** /**
* *
*/ */
class FooPlayer class FooSandbox
{ {
static private org.apache.log4j.Logger logger; static private org.apache.log4j.Logger logger;
@ -32,7 +32,7 @@ class FooPlayer
logger.info("... done."); logger.info("... done.");
logger.debug("Exit"); logger.debug("Exit");
logger = org.apache.log4j.Logger.getLogger(FooPlayer.class.getName()); logger = org.apache.log4j.Logger.getLogger(FooSandbox.class.getName());
} }
/** /**