From b533217d7f10158ec08cc2963271e828632df679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20D=C3=A9nari=C3=A9?= Date: Wed, 19 Jan 2022 10:05:41 +0100 Subject: [PATCH] Task-49792 : Remove cyclic dependency with kernel (#17) Before this fix, there was a dependency on kernel module to use ExoLogger This fix remove the dependency and use classic slf4j api LoggerFactory.getLogger, with create a logback logger --- pom.xml | 5 ----- .../org/gatein/wci/tomcat/TomcatContainerServlet.java | 7 +++---- .../gatein/wci/tomcat/TomcatServletContainerContext.java | 7 ++++--- wci/pom.xml | 8 ++++++-- wci/src/main/java/org/gatein/wci/ServletContainer.java | 9 ++++----- .../java/org/gatein/wci/spi/CatalinaWebAppContext.java | 6 +++--- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index 108269f9a..e56d9669f 100644 --- a/pom.xml +++ b/pom.xml @@ -63,11 +63,6 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. wci-wci ${project.version} - - org.exoplatform.kernel - exo.kernel.commons - ${project.version} - org.exoplatform.gatein.wci wci-tomcat diff --git a/tomcat/src/main/java/org/gatein/wci/tomcat/TomcatContainerServlet.java b/tomcat/src/main/java/org/gatein/wci/tomcat/TomcatContainerServlet.java index 131c88c7e..7ae9d6f13 100644 --- a/tomcat/src/main/java/org/gatein/wci/tomcat/TomcatContainerServlet.java +++ b/tomcat/src/main/java/org/gatein/wci/tomcat/TomcatContainerServlet.java @@ -26,9 +26,8 @@ import org.apache.catalina.ContainerServlet; import org.apache.catalina.Engine; import org.apache.catalina.Wrapper; -import org.exoplatform.services.log.ExoLogger; -import org.exoplatform.services.log.Log; - +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -38,7 +37,7 @@ */ public class TomcatContainerServlet extends HttpServlet implements ContainerServlet { - private static final Log log = ExoLogger.getLogger(TomcatContainerServlet.class); + private static final Logger log = LoggerFactory.getLogger(TomcatContainerServlet.class); /** Servlet context init parameter name that can be used to turn off cross-context logout */ private static final String CROSS_CONTEXT_LOGOUT_KEY = "org.gatein.wci.cross_context_logout"; diff --git a/tomcat/src/main/java/org/gatein/wci/tomcat/TomcatServletContainerContext.java b/tomcat/src/main/java/org/gatein/wci/tomcat/TomcatServletContainerContext.java index e3d1e70f3..4cb1ef55b 100644 --- a/tomcat/src/main/java/org/gatein/wci/tomcat/TomcatServletContainerContext.java +++ b/tomcat/src/main/java/org/gatein/wci/tomcat/TomcatServletContainerContext.java @@ -33,8 +33,8 @@ import org.apache.catalina.LifecycleListener; import org.apache.catalina.LifecycleState; import org.apache.catalina.core.StandardContext; -import org.exoplatform.services.log.ExoLogger; -import org.exoplatform.services.log.Log; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; import org.gatein.wci.RequestDispatchCallback; import org.gatein.wci.ServletContainer; import org.gatein.wci.ServletContainerFactory; @@ -65,7 +65,8 @@ */ public class TomcatServletContainerContext implements ServletContainerContext, ContainerListener, LifecycleListener { - private final static Log log = ExoLogger.getLogger(TomcatServletContainerContext.class); + private final static Logger log = + LoggerFactory.getLogger(TomcatServletContainerContext.class); private static TomcatServletContainerContext instance; diff --git a/wci/pom.xml b/wci/pom.xml index de425cd70..c32fd6566 100644 --- a/wci/pom.xml +++ b/wci/pom.xml @@ -32,8 +32,12 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. javax.servlet-api - org.exoplatform.kernel - exo.kernel.commons + ch.qos.logback + logback-classic + + + org.slf4j + slf4j-api diff --git a/wci/src/main/java/org/gatein/wci/ServletContainer.java b/wci/src/main/java/org/gatein/wci/ServletContainer.java index e440a7f9d..af5420ffc 100644 --- a/wci/src/main/java/org/gatein/wci/ServletContainer.java +++ b/wci/src/main/java/org/gatein/wci/ServletContainer.java @@ -37,8 +37,6 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.exoplatform.services.log.ExoLogger; -import org.exoplatform.services.log.Log; import org.gatein.wci.api.GateInServlet; import org.gatein.wci.authentication.AuthenticationEvent; import org.gatein.wci.authentication.AuthenticationEventType; @@ -48,6 +46,8 @@ import org.gatein.wci.security.Credentials; import org.gatein.wci.spi.ServletContainerContext; import org.gatein.wci.spi.WebAppContext; +import org.slf4j.LoggerFactory; +import org.slf4j.Logger; /** * A static registry for the servlet container context. @@ -58,10 +58,9 @@ public final class ServletContainer { - private final static Log log = ExoLogger.getLogger(ServletContainer.class); - + private static final Logger log = LoggerFactory.getLogger(ServletContainer.class); /** . */ - private final Object lock = new Object(); + private final Object lock = new Object(); /** The event webapp listeners. */ private final Vector webAppListeners = new Vector(); diff --git a/wci/src/main/java/org/gatein/wci/spi/CatalinaWebAppContext.java b/wci/src/main/java/org/gatein/wci/spi/CatalinaWebAppContext.java index c8261b614..734519a72 100644 --- a/wci/src/main/java/org/gatein/wci/spi/CatalinaWebAppContext.java +++ b/wci/src/main/java/org/gatein/wci/spi/CatalinaWebAppContext.java @@ -16,8 +16,8 @@ */ package org.gatein.wci.spi; -import org.exoplatform.services.log.ExoLogger; -import org.exoplatform.services.log.Log; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.gatein.wci.command.CommandServlet; import javax.naming.InitialContext; @@ -31,7 +31,7 @@ * @author Ken Finnigan */ public abstract class CatalinaWebAppContext implements WebAppContext { - protected final static Log log = ExoLogger.getLogger(CatalinaWebAppContext.class); + protected static final Logger log = LoggerFactory.getLogger(CatalinaWebAppContext.class); protected static final String GATEIN_SERVLET_NAME = "TomcatGateInServlet"; protected static final String GATEIN_SERVLET_PATH = "/tomcatgateinservlet";