Author: julien_viet
Date: 2009-11-15 17:45:00 -0500 (Sun, 15 Nov 2009)
New Revision: 598
Added:
components/common/trunk/logging/
components/common/trunk/logging/pom.xml
components/common/trunk/logging/src/
components/common/trunk/logging/src/main/
components/common/trunk/logging/src/main/java/
components/common/trunk/logging/src/main/java/org/
components/common/trunk/logging/src/main/java/org/gatein/
components/common/trunk/logging/src/main/java/org/gatein/common/
components/common/trunk/logging/src/main/java/org/gatein/common/logging/
components/common/trunk/logging/src/main/java/org/gatein/common/logging/LogLevel.java
components/common/trunk/logging/src/main/java/org/gatein/common/logging/Logger.java
components/common/trunk/logging/src/main/java/org/gatein/common/logging/LoggerFactory.java
components/common/trunk/logging/src/main/java/org/gatein/common/logging/SLF4JLocationAwareLogger.java
components/common/trunk/logging/src/main/java/org/gatein/common/logging/SimpleLogger.java
components/common/trunk/logging/src/main/java/org/gatein/common/logging/package-info.java
components/common/trunk/logging/src/main/resources/
components/common/trunk/logging/src/test/
components/common/trunk/logging/src/test/java/
components/common/trunk/logging/src/test/java/org/
components/common/trunk/logging/src/test/java/org/gatein/
components/common/trunk/logging/src/test/java/org/gatein/common/
components/common/trunk/logging/src/test/java/org/gatein/common/logging/
components/common/trunk/logging/src/test/java/org/gatein/common/logging/LogTestCase.java
components/common/trunk/logging/src/test/java/org/slf4j/
components/common/trunk/logging/src/test/java/org/slf4j/impl/
components/common/trunk/logging/src/test/java/org/slf4j/impl/Log.java
components/common/trunk/logging/src/test/java/org/slf4j/impl/LoggerFactoryImpl.java
components/common/trunk/logging/src/test/java/org/slf4j/impl/LoggerImpl.java
components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticLoggerBinder.java
components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticMDCBinder.java
components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticMarkerBinder.java
components/common/trunk/logging/src/test/resources/
Modified:
components/common/trunk/common/pom.xml
components/common/trunk/pom.xml
Log:
GTNCOMMON-4: Logging facade
Modified: components/common/trunk/common/pom.xml
===================================================================
--- components/common/trunk/common/pom.xml 2009-11-13 22:36:33 UTC (rev 597)
+++ components/common/trunk/common/pom.xml 2009-11-15 22:45:00 UTC (rev 598)
@@ -76,6 +76,12 @@
<artifactId>junit</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.6</version>
+ </dependency>
+
</dependencies>
<build>
Added: components/common/trunk/logging/pom.xml
===================================================================
--- components/common/trunk/logging/pom.xml (rev 0)
+++ components/common/trunk/logging/pom.xml 2009-11-15 22:45:00 UTC (rev 598)
@@ -0,0 +1,46 @@
+<!--
+ ~ Copyright (C) 2009 eXo Platform SAS.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.gatein.common</groupId>
+ <artifactId>common-parent</artifactId>
+ <version>2.0.0-CR1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>common-logging</artifactId>
+ <packaging>jar</packaging>
+ <name>GateIn - Common component (logging)</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added:
components/common/trunk/logging/src/main/java/org/gatein/common/logging/LogLevel.java
===================================================================
--- components/common/trunk/logging/src/main/java/org/gatein/common/logging/LogLevel.java
(rev 0)
+++
components/common/trunk/logging/src/main/java/org/gatein/common/logging/LogLevel.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,139 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.gatein.common.logging;
+
+import org.slf4j.spi.LocationAwareLogger;
+
+/**
+ * The level of a log message.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public enum LogLevel
+{
+ /**
+ * Trace log level.
+ */
+ TRACE(LocationAwareLogger.TRACE_INT)
+ {
+ @Override
+ void log(org.slf4j.Logger delegate, Object msg, Throwable throwable)
+ {
+ delegate.trace(String.valueOf(msg), throwable);
+ }
+
+ @Override
+ boolean isEnabled(org.slf4j.Logger delegate)
+ {
+ return delegate.isTraceEnabled();
+ }
+ },
+
+ /**
+ * Debug log level.
+ */
+ DEBUG(LocationAwareLogger.DEBUG_INT)
+ {
+ @Override
+ void log(org.slf4j.Logger delegate, Object msg, Throwable throwable)
+ {
+ delegate.debug(String.valueOf(msg), throwable);
+ }
+
+ @Override
+ boolean isEnabled(org.slf4j.Logger delegate)
+ {
+ return delegate.isDebugEnabled();
+ }
+ },
+
+ /**
+ * Info log level.
+ */
+ INFO(LocationAwareLogger.INFO_INT)
+ {
+ @Override
+ void log(org.slf4j.Logger delegate, Object msg, Throwable throwable)
+ {
+ delegate.info(String.valueOf(msg), throwable);
+ }
+
+ @Override
+ boolean isEnabled(org.slf4j.Logger delegate)
+ {
+ return delegate.isInfoEnabled();
+ }
+ },
+
+ /**
+ * Warn log level.
+ */
+ WARN(LocationAwareLogger.WARN_INT)
+ {
+ @Override
+ void log(org.slf4j.Logger delegate, Object msg, Throwable throwable)
+ {
+ delegate.warn(String.valueOf(msg), throwable);
+ }
+
+ @Override
+ boolean isEnabled(org.slf4j.Logger delegate)
+ {
+ return delegate.isWarnEnabled();
+ }
+ },
+
+ /**
+ * Warn log level.
+ */
+ ERROR(LocationAwareLogger.ERROR_INT)
+ {
+ @Override
+ void log(org.slf4j.Logger delegate, Object msg, Throwable throwable)
+ {
+ delegate.error(String.valueOf(msg), throwable);
+ }
+
+ @Override
+ boolean isEnabled(org.slf4j.Logger delegate)
+ {
+ return delegate.isErrorEnabled();
+ }
+ }
+
+ ;
+
+ private final int slf4Jlevel;
+
+ LogLevel(int slf4Jlevel)
+ {
+ this.slf4Jlevel = slf4Jlevel;
+ }
+
+ int getSLF4Jlevel()
+ {
+ return slf4Jlevel;
+ }
+
+ abstract void log(org.slf4j.Logger delegate, Object msg, Throwable throwable);
+
+ abstract boolean isEnabled(org.slf4j.Logger delegate);
+
+}
Added:
components/common/trunk/logging/src/main/java/org/gatein/common/logging/Logger.java
===================================================================
--- components/common/trunk/logging/src/main/java/org/gatein/common/logging/Logger.java
(rev 0)
+++
components/common/trunk/logging/src/main/java/org/gatein/common/logging/Logger.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,158 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.gatein.common.logging;
+
+/**
+ * The logger for GateIn.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public abstract class Logger
+{
+
+ /** Helps the compiler to be happy. */
+ private static final Object[] NO_PARAMETERS = null;
+
+ protected abstract void doLog(LogLevel level, Object msg, Throwable throwable);
+
+ protected abstract org.slf4j.Logger getDelegate();
+
+ private void log(LogLevel level, Object msg, Throwable throwable, Object...
parameters)
+ {
+ if (level == null)
+ {
+ level = LogLevel.INFO;
+ }
+
+ // Take care of interpolation
+ if (parameters != null && parameters.length > 0)
+ {
+ throw new UnsupportedOperationException("log interpolation to do, for now
it cannot be called");
+ }
+
+ //
+ doLog(level, msg, throwable);
+ }
+
+ public final String getName()
+ {
+ return getDelegate().getName();
+ }
+
+ public final boolean isEnabled(LogLevel level)
+ {
+ if (level == null)
+ {
+ level = LogLevel.INFO;
+ }
+ return level.isEnabled(getDelegate());
+ }
+
+ public final void log(LogLevel level, Object msg)
+ {
+ log(level, msg, null, NO_PARAMETERS);
+ }
+
+ public final void log(LogLevel level, Object msg, Throwable throwable)
+ {
+ log(level, msg, throwable, NO_PARAMETERS);
+ }
+
+ public final boolean isTraceEnabled()
+ {
+ return isEnabled(LogLevel.TRACE);
+ }
+
+ public final void trace(Object msg)
+ {
+ log(LogLevel.TRACE, msg, null, NO_PARAMETERS);
+ }
+
+ public final void trace(Object msg, Throwable throwable)
+ {
+ log(LogLevel.TRACE, msg, throwable, NO_PARAMETERS);
+ }
+
+ public final boolean isDebugEnabled()
+ {
+ return isEnabled(LogLevel.DEBUG);
+ }
+
+ public final void debug(Object msg)
+ {
+ log(LogLevel.DEBUG, msg, null, NO_PARAMETERS);
+ }
+
+ public final void debug(Object msg, Throwable throwable)
+ {
+ log(LogLevel.DEBUG, msg, throwable, NO_PARAMETERS);
+ }
+
+ public final boolean isInfoEnabled()
+ {
+ return isEnabled(LogLevel.INFO);
+ }
+
+ public final void info(Object msg)
+ {
+ log(LogLevel.INFO, msg, null, NO_PARAMETERS);
+ }
+
+ public final void info(Object msg, Throwable throwable)
+ {
+ log(LogLevel.INFO, msg, throwable, NO_PARAMETERS);
+ }
+
+ public final boolean isWarnEnabled()
+ {
+ return isEnabled(LogLevel.WARN);
+ }
+
+ public final void warn(Object msg)
+ {
+ log(LogLevel.WARN, msg, null, NO_PARAMETERS);
+ }
+
+ public final void warn(Object msg, Throwable throwable)
+ {
+ log(LogLevel.WARN, msg, throwable, NO_PARAMETERS);
+ }
+
+ public final boolean isErrorEnabled()
+ {
+ return isEnabled(LogLevel.ERROR);
+ }
+
+ public final void error(Object msg)
+ {
+ log(LogLevel.ERROR, msg, null, NO_PARAMETERS);
+ }
+
+ public final void error(Object msg, Throwable throwable)
+ {
+ log(LogLevel.ERROR, msg, throwable, NO_PARAMETERS);
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Logger[name=" + getDelegate().getName() + "]";
+ }
+}
Added:
components/common/trunk/logging/src/main/java/org/gatein/common/logging/LoggerFactory.java
===================================================================
---
components/common/trunk/logging/src/main/java/org/gatein/common/logging/LoggerFactory.java
(rev 0)
+++
components/common/trunk/logging/src/main/java/org/gatein/common/logging/LoggerFactory.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,92 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.gatein.common.logging;
+
+import org.slf4j.spi.LocationAwareLogger;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * The common way to obtain a logger.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class LoggerFactory
+{
+
+ /** . */
+ private static final ConcurrentMap<String, Logger> loggers = new
ConcurrentHashMap<String, Logger>();
+
+ /**
+ * Returns a logger by its name.
+ *
+ * @param name the logger name
+ * @return the logger
+ * @throws NullPointerException if the logger name is null
+ */
+ public static Logger getLogger(String name) throws NullPointerException
+ {
+ if (name == null)
+ {
+ throw new NullPointerException("No null logger name accepted");
+ }
+ Logger logger = loggers.get(name);
+ if (logger == null)
+ {
+ logger = createLogger(name);
+ Logger phantom = loggers.putIfAbsent(name, logger);
+ if (phantom != null)
+ {
+ logger = phantom;
+ }
+ }
+ return logger;
+ }
+
+ /**
+ * Returns a logger by its name based on the value returned by {@link
Class#getName()}
+ *
+ * @param type the class type
+ * @return the logger
+ * @throws NullPointerException if the class type is null
+ */
+ public static Logger getLogger(Class type)
+ {
+ if (type == null)
+ {
+ throw new NullPointerException("No null class type accepted");
+ }
+ return getLogger(type.getName());
+ }
+
+ private static Logger createLogger(String name)
+ {
+ org.slf4j.Logger slf4jlogger = org.slf4j.LoggerFactory.getLogger(name);
+ if (slf4jlogger instanceof LocationAwareLogger)
+ {
+ return new SLF4JLocationAwareLogger((LocationAwareLogger)slf4jlogger);
+ }
+ else
+ {
+ return new SimpleLogger(slf4jlogger);
+ }
+ }
+}
Added:
components/common/trunk/logging/src/main/java/org/gatein/common/logging/SLF4JLocationAwareLogger.java
===================================================================
---
components/common/trunk/logging/src/main/java/org/gatein/common/logging/SLF4JLocationAwareLogger.java
(rev 0)
+++
components/common/trunk/logging/src/main/java/org/gatein/common/logging/SLF4JLocationAwareLogger.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,52 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.gatein.common.logging;
+
+import org.slf4j.spi.LocationAwareLogger;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+class SLF4JLocationAwareLogger extends Logger
+{
+
+ /** . */
+ private static final String FQCN = SLF4JLocationAwareLogger.class.getName();
+
+ /** . */
+ private final LocationAwareLogger delegate;
+
+ public SLF4JLocationAwareLogger(LocationAwareLogger delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ @Override
+ protected void doLog(LogLevel level, Object msg, Throwable throwable)
+ {
+ delegate.log(null, FQCN, level.getSLF4Jlevel(), String.valueOf(msg), throwable);
+ }
+
+ @Override
+ protected org.slf4j.Logger getDelegate()
+ {
+ return delegate;
+ }
+}
Added:
components/common/trunk/logging/src/main/java/org/gatein/common/logging/SimpleLogger.java
===================================================================
---
components/common/trunk/logging/src/main/java/org/gatein/common/logging/SimpleLogger.java
(rev 0)
+++
components/common/trunk/logging/src/main/java/org/gatein/common/logging/SimpleLogger.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.gatein.common.logging;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+class SimpleLogger extends Logger
+{
+
+ /** . */
+ private final org.slf4j.Logger delegate;
+
+ public SimpleLogger(org.slf4j.Logger delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ @Override
+ protected void doLog(LogLevel level, Object msg, Throwable throwable)
+ {
+ level.log(delegate, msg, throwable);
+ }
+
+ @Override
+ protected org.slf4j.Logger getDelegate()
+ {
+ return delegate;
+ }
+}
Added:
components/common/trunk/logging/src/main/java/org/gatein/common/logging/package-info.java
===================================================================
---
components/common/trunk/logging/src/main/java/org/gatein/common/logging/package-info.java
(rev 0)
+++
components/common/trunk/logging/src/main/java/org/gatein/common/logging/package-info.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,9 @@
+/**
+ * <p>The logging system for GateIn components and project.</p>
+ *
+ * <p>The logging system focuses on providing an API and not an implementation. The
implementation of the logging
+ * system uses the <a
href="http://www.slf4j.org/">SLF4J</a>
logging framework. Although the SLF4J frameworks
+ * is already a facade for various logging framework, the goal of this facade is to
decouple the GateIn project
+ * from a system considered as proprietary although under an open source
license.</p>
+ */
+package org.gatein.common.logger;
Added:
components/common/trunk/logging/src/test/java/org/gatein/common/logging/LogTestCase.java
===================================================================
---
components/common/trunk/logging/src/test/java/org/gatein/common/logging/LogTestCase.java
(rev 0)
+++
components/common/trunk/logging/src/test/java/org/gatein/common/logging/LogTestCase.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,253 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.gatein.common.logging;
+
+import junit.framework.TestCase;
+import org.slf4j.impl.Log;
+import org.slf4j.impl.LoggerFactoryImpl;
+import org.slf4j.impl.LoggerImpl;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class LogTestCase extends TestCase
+{
+
+ public void testGetLogger()
+ {
+ Logger logger = LoggerFactory.getLogger(LogTestCase.class);
+ assertNotNull(logger);
+ assertEquals(LogTestCase.class.getName(), logger.getName());
+ assertSame(logger, LoggerFactory.getLogger(LogTestCase.class.getName()));
+ }
+
+ public void testConcurrentGetRace() throws Exception
+ {
+ final ReentrantLock lock = LoggerFactoryImpl.getLock();
+ lock.lock();
+ final AtomicReference<Logger> loggerRef = new
AtomicReference<Logger>();
+ final AtomicBoolean done = new AtomicBoolean();
+ Thread t = new Thread()
+ {
+ public void run()
+ {
+ Logger logger = LoggerFactory.getLogger("testConcurrentGetRace");
+ loggerRef.set(logger);
+ done.set(true);
+ }
+ };
+ t.start();
+ while (!lock.hasQueuedThread(t))
+ {
+ Thread.sleep(1);
+ }
+ assertEquals(null,
LoggerFactoryImpl.peekLogger("testConcurrentGetRace"));
+ Logger logger = LoggerFactory.getLogger("testConcurrentGetRace");
+ assertNotNull(logger);
+ lock.unlock();
+ while (!done.get())
+ {
+ Thread.sleep(1);
+ }
+ assertSame(logger, loggerRef.get());
+ }
+
+ public void testTraceEnabled()
+ {
+ Logger logger = LoggerFactory.getLogger("testTraceEnabled");
+ LoggerImpl loggerImpl =
LoggerFactoryImpl.peekLogger("testTraceEnabled");
+ assertTrue(logger.isTraceEnabled());
+ loggerImpl.traceEnabled = false;
+ assertFalse(logger.isTraceEnabled());
+ }
+
+ public void testTrace()
+ {
+ LoggerFactoryImpl.assertEmpty();
+ Logger logger = LoggerFactory.getLogger("testTrace");
+ logger.trace("testTrace1");
+ LoggerFactoryImpl.assertLog("testTrace", Log.TRACE,
"testTrace1", null);
+ LoggerFactoryImpl.assertEmpty();
+ Throwable t = new Throwable();
+ logger.trace("testTrace2", t);
+ LoggerFactoryImpl.assertLog("testTrace", Log.TRACE,
"testTrace2", t);
+ LoggerFactoryImpl.assertEmpty();
+ }
+
+ public void testDebugEnabled()
+ {
+ Logger logger = LoggerFactory.getLogger("testDebugEnabled");
+ LoggerImpl loggerImpl =
LoggerFactoryImpl.peekLogger("testDebugEnabled");
+ assertTrue(logger.isDebugEnabled());
+ loggerImpl.debugEnabled = false;
+ assertFalse(logger.isDebugEnabled());
+ }
+
+ public void testDebug()
+ {
+ LoggerFactoryImpl.assertEmpty();
+ Logger logger = LoggerFactory.getLogger("testDebug");
+ logger.debug("testDebug1");
+ LoggerFactoryImpl.assertLog("testDebug", Log.DEBUG,
"testDebug1", null);
+ LoggerFactoryImpl.assertEmpty();
+ Throwable t = new Throwable();
+ logger.debug("testDebug2", t);
+ LoggerFactoryImpl.assertLog("testDebug", Log.DEBUG,
"testDebug2", t);
+ LoggerFactoryImpl.assertEmpty();
+ }
+
+ public void testInfoEnabled()
+ {
+ Logger logger = LoggerFactory.getLogger("testInfoEnabled");
+ LoggerImpl loggerImpl = LoggerFactoryImpl.peekLogger("testInfoEnabled");
+ assertTrue(logger.isInfoEnabled());
+ loggerImpl.infoEnabled = false;
+ assertFalse(logger.isInfoEnabled());
+ }
+
+ public void testInfo()
+ {
+ LoggerFactoryImpl.assertEmpty();
+ Logger logger = LoggerFactory.getLogger("testInfo");
+ logger.info("testInfo1");
+ LoggerFactoryImpl.assertLog("testInfo", Log.INFO, "testInfo1",
null);
+ LoggerFactoryImpl.assertEmpty();
+ Throwable t = new Throwable();
+ logger.info("testInfo2", t);
+ LoggerFactoryImpl.assertLog("testInfo", Log.INFO, "testInfo2",
t);
+ LoggerFactoryImpl.assertEmpty();
+ }
+
+ public void testWarnEnabled()
+ {
+ Logger logger = LoggerFactory.getLogger("testWarnEnabled");
+ LoggerImpl loggerImpl = LoggerFactoryImpl.peekLogger("testWarnEnabled");
+ assertTrue(logger.isWarnEnabled());
+ loggerImpl.warnEnabled = false;
+ assertFalse(logger.isWarnEnabled());
+ }
+
+ public void testWarn()
+ {
+ LoggerFactoryImpl.assertEmpty();
+ Logger logger = LoggerFactory.getLogger("testWarn");
+ logger.warn("testWarn1");
+ LoggerFactoryImpl.assertLog("testWarn", Log.WARN, "testWarn1",
null);
+ LoggerFactoryImpl.assertEmpty();
+ Throwable t = new Throwable();
+ logger.warn("testWarn2", t);
+ LoggerFactoryImpl.assertLog("testWarn", Log.WARN, "testWarn2",
t);
+ LoggerFactoryImpl.assertEmpty();
+ }
+
+ public void testErrorEnabled()
+ {
+ Logger logger = LoggerFactory.getLogger("testErrorEnabled");
+ LoggerImpl loggerImpl =
LoggerFactoryImpl.peekLogger("testErrorEnabled");
+ assertTrue(logger.isErrorEnabled());
+ loggerImpl.errorEnabled = false;
+ assertFalse(logger.isErrorEnabled());
+ }
+
+ public void testError()
+ {
+ LoggerFactoryImpl.assertEmpty();
+ Logger logger = LoggerFactory.getLogger("testError");
+ logger.error("testError1");
+ LoggerFactoryImpl.assertLog("testError", Log.ERROR,
"testError1", null);
+ LoggerFactoryImpl.assertEmpty();
+ Throwable t = new Throwable();
+ logger.error("testError2", t);
+ LoggerFactoryImpl.assertLog("testError", Log.ERROR,
"testError2", t);
+ LoggerFactoryImpl.assertEmpty();
+ }
+
+ public void testDetypedEnabled()
+ {
+ Logger logger = LoggerFactory.getLogger("testDetypedEnabled");
+ LoggerImpl loggerImpl =
LoggerFactoryImpl.peekLogger("testDetypedEnabled");
+ LogLevel[] levels = LogLevel.values();
+ for (LogLevel level : levels)
+ {
+ assertTrue(logger.isEnabled(level));
+ switch (level)
+ {
+ case TRACE:
+ loggerImpl.traceEnabled = false;
+ break;
+ case DEBUG:
+ loggerImpl.debugEnabled = false;
+ break;
+ case INFO:
+ loggerImpl.infoEnabled = false;
+ break;
+ case WARN:
+ loggerImpl.warnEnabled = false;
+ break;
+ case ERROR:
+ loggerImpl.errorEnabled = false;
+ break;
+ }
+ assertFalse(logger.isEnabled(level));
+ }
+ }
+
+ public void testDetypedLog()
+ {
+ LoggerFactoryImpl.assertEmpty();
+ Logger logger = LoggerFactory.getLogger("testDetypedLog");
+ LogLevel[] levels = LogLevel.values();
+ for (int i = 0;i < levels.length;i++)
+ {
+ LogLevel level = levels[i];
+ logger.log(level, "testDetypedLog1_" + i);
+ LoggerFactoryImpl.assertLog("testDetypedLog", level.ordinal(),
"testDetypedLog1_" + i, null);
+ LoggerFactoryImpl.assertEmpty();
+ Throwable t = new Throwable();
+ logger.log(level, "testDetypedLog2_" + i, t);
+ LoggerFactoryImpl.assertLog("testDetypedLog", level.ordinal(),
"testDetypedLog2_" + i, t);
+ LoggerFactoryImpl.assertEmpty();
+ }
+ }
+
+ public void testGetLoggerNPE()
+ {
+ try
+ {
+ LoggerFactory.getLogger((String)null);
+ fail();
+ }
+ catch (NullPointerException e)
+ {
+ }
+ try
+ {
+ LoggerFactory.getLogger((Class)null);
+ fail();
+ }
+ catch (NullPointerException e)
+ {
+ }
+ }
+}
Added: components/common/trunk/logging/src/test/java/org/slf4j/impl/Log.java
===================================================================
--- components/common/trunk/logging/src/test/java/org/slf4j/impl/Log.java
(rev 0)
+++ components/common/trunk/logging/src/test/java/org/slf4j/impl/Log.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.slf4j.impl;
+
+import org.gatein.common.logging.LogLevel;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class Log
+{
+
+ /** . */
+ public static final int TRACE = LogLevel.TRACE.ordinal();
+
+ /** . */
+ public static final int DEBUG = LogLevel.DEBUG.ordinal();
+
+ /** . */
+ public static final int INFO = LogLevel.INFO.ordinal();
+
+ /** . */
+ public static final int WARN = LogLevel.WARN.ordinal();
+
+ /** . */
+ public static final int ERROR = LogLevel.ERROR.ordinal();
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final int level;
+
+ /** . */
+ private final String msg;
+
+ /** . */
+ private final Throwable throwable;
+
+ public Log(String name, int level, String msg, Throwable throwable)
+ {
+ this.name = name;
+ this.level = level;
+ this.msg = msg;
+ this.throwable = throwable;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public int getLevel()
+ {
+ return level;
+ }
+
+ public String getMessage()
+ {
+ return msg;
+ }
+
+ public Throwable getThrowable()
+ {
+ return throwable;
+ }
+}
Added:
components/common/trunk/logging/src/test/java/org/slf4j/impl/LoggerFactoryImpl.java
===================================================================
--- components/common/trunk/logging/src/test/java/org/slf4j/impl/LoggerFactoryImpl.java
(rev 0)
+++
components/common/trunk/logging/src/test/java/org/slf4j/impl/LoggerFactoryImpl.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.slf4j.impl;
+
+import junit.framework.Assert;
+import org.slf4j.ILoggerFactory;
+import org.slf4j.Logger;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class LoggerFactoryImpl implements ILoggerFactory
+{
+
+ /** . */
+ private static final LinkedList<Log> logs = new LinkedList<Log>();
+
+ /** . */
+ private static final Map<String, LoggerImpl> loggers =
Collections.synchronizedMap(new HashMap<String, LoggerImpl>());
+
+ /** For testing concurrency purpose. */
+ private static final ReentrantLock lock = new ReentrantLock();
+
+ public LoggerFactoryImpl()
+ {
+ }
+
+ synchronized static void log(String name, int level, String msg, Throwable t)
+ {
+ logs.add(new Log(name, level, msg, t));
+ }
+
+ public synchronized static void assertEmpty()
+ {
+ Assert.assertTrue(logs.isEmpty());
+ }
+
+ public synchronized static void assertLog(String name, int level, String msg,
Throwable t)
+ {
+ Assert.assertFalse(logs.isEmpty());
+ Log log = logs.removeFirst();
+ Assert.assertEquals(name, log.getName());
+ Assert.assertEquals(level, log.getLevel());
+ Assert.assertEquals(msg, log.getMessage());
+ Assert.assertEquals(t, log.getThrowable());
+ }
+
+ public static LoggerImpl peekLogger(String name)
+ {
+ return loggers.get(name);
+ }
+
+ public static ReentrantLock getLock()
+ {
+ return lock;
+ }
+
+ public LoggerImpl getLogger(String name)
+ {
+ lock.lock();
+ try
+ {
+ LoggerImpl logger = loggers.get(name);
+ if (logger == null)
+ {
+ logger = new LoggerImpl(name);
+ loggers.put(name, logger);
+ }
+ return logger;
+ }
+ finally
+ {
+ lock.unlock();
+ }
+ }
+}
Added: components/common/trunk/logging/src/test/java/org/slf4j/impl/LoggerImpl.java
===================================================================
--- components/common/trunk/logging/src/test/java/org/slf4j/impl/LoggerImpl.java
(rev 0)
+++
components/common/trunk/logging/src/test/java/org/slf4j/impl/LoggerImpl.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.slf4j.impl;
+
+import org.slf4j.helpers.MarkerIgnoringBase;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class LoggerImpl extends MarkerIgnoringBase
+{
+
+ /** . */
+ public boolean traceEnabled = true;
+
+ /** . */
+ public boolean debugEnabled = true;
+
+ /** . */
+ public boolean infoEnabled = true;
+
+ /** . */
+ public boolean warnEnabled = true;
+
+ /** . */
+ public boolean errorEnabled = true;
+
+ public LoggerImpl(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return traceEnabled;
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return debugEnabled;
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return infoEnabled;
+ }
+
+ public boolean isWarnEnabled()
+ {
+ return warnEnabled;
+ }
+
+ public boolean isErrorEnabled()
+ {
+ return errorEnabled;
+ }
+
+ public void trace(String msg)
+ {
+ trace(msg, (Throwable)null);
+ }
+
+ public void trace(String msg, Throwable t)
+ {
+ LoggerFactoryImpl.log(name, Log.TRACE, msg, t);
+ }
+
+ public void debug(String msg)
+ {
+ debug(msg, (Throwable)null);
+ }
+
+ public void debug(String msg, Throwable t)
+ {
+ LoggerFactoryImpl.log(name, Log.DEBUG, msg, t);
+ }
+
+ public void info(String msg)
+ {
+ info(msg, (Throwable)null);
+ }
+
+ public void info(String msg, Throwable t)
+ {
+ LoggerFactoryImpl.log(name, Log.INFO, msg, t);
+ }
+
+ public void warn(String msg)
+ {
+ warn(msg, (Throwable)null);
+ }
+
+ public void warn(String msg, Throwable t)
+ {
+ LoggerFactoryImpl.log(name, Log.WARN, msg, t);
+ }
+
+ public void error(String msg)
+ {
+ error(msg, (Throwable)null);
+ }
+
+ public void error(String msg, Throwable t)
+ {
+ LoggerFactoryImpl.log(name, Log.ERROR, msg, t);
+ }
+
+ public void trace(String format, Object arg)
+ {
+ throw new Error();
+ }
+
+ public void trace(String format, Object arg1, Object arg2)
+ {
+ throw new Error();
+ }
+
+ public void trace(String format, Object[] argArray)
+ {
+ throw new Error();
+ }
+
+ public void debug(String format, Object arg)
+ {
+ throw new Error();
+ }
+
+ public void debug(String format, Object arg1, Object arg2)
+ {
+ throw new Error();
+ }
+
+ public void debug(String format, Object[] argArray)
+ {
+ throw new Error();
+ }
+
+ public void info(String format, Object arg)
+ {
+ throw new Error();
+ }
+
+ public void info(String format, Object arg1, Object arg2)
+ {
+ throw new Error();
+ }
+
+ public void info(String format, Object[] argArray)
+ {
+ throw new Error();
+ }
+
+ public void warn(String format, Object arg)
+ {
+ throw new Error();
+ }
+
+ public void warn(String format, Object[] argArray)
+ {
+ throw new Error();
+ }
+
+ public void warn(String format, Object arg1, Object arg2)
+ {
+ throw new Error();
+ }
+
+ public void error(String format, Object arg)
+ {
+ throw new Error();
+ }
+
+ public void error(String format, Object arg1, Object arg2)
+ {
+ throw new Error();
+ }
+
+ public void error(String format, Object[] argArray)
+ {
+ throw new Error();
+ }
+}
Added:
components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticLoggerBinder.java
===================================================================
--- components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticLoggerBinder.java
(rev 0)
+++
components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticLoggerBinder.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.slf4j.impl;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.spi.LoggerFactoryBinder;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class StaticLoggerBinder implements LoggerFactoryBinder
+{
+
+ private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
+
+ public static StaticLoggerBinder getSingleton() {
+ return SINGLETON;
+ }
+
+ public static String REQUESTED_API_VERSION = "1.5.6";
+
+ private static final String loggerFactoryClassStr =
LoggerFactoryImpl.class.getName();
+
+ private final ILoggerFactory loggerFactory;
+
+ private StaticLoggerBinder() {
+ loggerFactory = new LoggerFactoryImpl();
+ }
+
+ public ILoggerFactory getLoggerFactory() {
+ return loggerFactory;
+ }
+
+ public String getLoggerFactoryClassStr() {
+ return loggerFactoryClassStr;
+ }
+}
Added: components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticMDCBinder.java
===================================================================
--- components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticMDCBinder.java
(rev 0)
+++
components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticMDCBinder.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.slf4j.impl;
+
+import org.slf4j.helpers.NOPMakerAdapter;
+import org.slf4j.spi.MDCAdapter;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class StaticMDCBinder
+{
+
+ public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
+
+ public MDCAdapter getMDCA()
+ {
+ return new NOPMakerAdapter();
+ }
+
+ public String getMDCAdapterClassStr()
+ {
+ return NOPMakerAdapter.class.getName();
+ }
+}
Added:
components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticMarkerBinder.java
===================================================================
--- components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticMarkerBinder.java
(rev 0)
+++
components/common/trunk/logging/src/test/java/org/slf4j/impl/StaticMarkerBinder.java 2009-11-15
22:45:00 UTC (rev 598)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.slf4j.impl;
+
+import org.slf4j.IMarkerFactory;
+import org.slf4j.helpers.BasicMarkerFactory;
+import org.slf4j.spi.MarkerFactoryBinder;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
+ * @version $Revision$
+ */
+public class StaticMarkerBinder implements MarkerFactoryBinder
+{
+
+ public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();
+
+ final IMarkerFactory markerFactory = new BasicMarkerFactory();
+
+ private StaticMarkerBinder() {
+ }
+
+ public IMarkerFactory getMarkerFactory() {
+ return markerFactory;
+ }
+
+ public String getMarkerFactoryClassStr() {
+ return BasicMarkerFactory.class.getName();
+ }
+}
Modified: components/common/trunk/pom.xml
===================================================================
--- components/common/trunk/pom.xml 2009-11-13 22:36:33 UTC (rev 597)
+++ components/common/trunk/pom.xml 2009-11-15 22:45:00 UTC (rev 598)
@@ -59,6 +59,7 @@
</repositories>
<modules>
+ <module>logging</module>
<module>common</module>
<module>mc</module>
</modules>