Commits

Stephen McKamey  committed 6a85dce

adding compact slf4j logger

  • Participants
  • Parent commits 78a2317

Comments (0)

Files changed (16)

 bootstrap/target
 war-bootstrap-archetype/target
 launch.sh
-test.war
+test.war
+tomcat
 Environment
 -----------
 
-- Java SE JDK 1.6u26
+- Java SE JDK 1.6
 	http://www.oracle.com/technetwork/java/javase/downloads/
 - Maven 3.0.3
 	http://maven.apache.org/download.html
 	mvn archetype:generate \
 		-DarchetypeGroupId=org.duelengine \
 		-DarchetypeArtifactId=war-bootstrap-archetype \
-		-DarchetypeVersion=0.3.0
+		-DarchetypeVersion=0.3.1
 
 	# build your boostrap
 	# NOTE: replace "bootstrap" with your chosen project name

File war-bootstrap-archetype/pom.xml

 
 	<groupId>org.duelengine</groupId>
 	<artifactId>war-bootstrap-archetype</artifactId>
-	<version>0.3.0</version>
+	<version>0.3.1</version>
 	<packaging>maven-archetype</packaging>
 
 	<name>WAR Bootstrap Archetype</name>

File war-bootstrap-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml

     <fileSet filtered="true" packaged="true" encoding="UTF-8">
       <directory>src/main/java</directory>
       <includes>
+        <include>*.java</include>
+        <include>logging/*.java</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" packaged="false" encoding="UTF-8">
+      <directory>src/main/java/org</directory>
+      <includes>
         <include>**/*.java</include>
       </includes>
     </fileSet>

File war-bootstrap-archetype/src/main/resources/archetype-resources/pom.xml

 		<glassfish.version>3.1.1</glassfish.version>
 		<jetty.version>8.1.1.v20120215</jetty.version>
 		<tomcat.version>7.0.26</tomcat.version>
+		<slf4j.version>1.6.4</slf4j.version>
 		<javac.version>1.6</javac.version>
 	</properties>
 
 		<!-- NOTE: GlassFish and Tomcat appear to be conflicting.
 			 order appears to matter and also
 			 must set scope to provided if not used -->
+
+		<!-- Jetty 7/8 embedded runtime -->
 		<dependency>
-			<!-- Jetty 7/8 embedded runtime -->
 			<groupId>org.eclipse.jetty.aggregate</groupId>
 			<artifactId>jetty-all</artifactId>
 			<version>${jetty.version}</version>
 		</dependency>
+
+		<!-- GlassFish 3.1 embedded runtime -->
 		<dependency>
-			<!-- GlassFish 3.1 embedded runtime -->
 			<groupId>org.glassfish.extras</groupId>
 			<artifactId>glassfish-embedded-web</artifactId>
 			<version>${glassfish.version}</version>
 			<scope>provided</scope><!-- comment this for GF3 -->
 		</dependency>
+
+		<!-- Tomcat 7 embedded runtime -->
 		<dependency>
-			<!-- Tomcat 7 embedded runtime -->
 			<groupId>org.apache.tomcat.embed</groupId>
 			<artifactId>tomcat-embed-core</artifactId>
 			<version>${tomcat.version}</version>
 			<!--scope>compile</scope--><!-- comment this for TC7 -->
 		</dependency>
+
+		<!-- Tomcat 7 JSP -->
 		<dependency>
-			<!-- Tomcat 7 JSP -->
 			<groupId>org.apache.tomcat.embed</groupId>
 			<artifactId>tomcat-embed-jasper</artifactId>
 			<version>${tomcat.version}</version>
 			<scope>compile</scope>
 		</dependency>
+
+		<!-- Tomcat 7 logging -->
 		<dependency>
-			<!-- Tomcat 7 logging -->
 			<groupId>org.apache.tomcat.embed</groupId>
 			<artifactId>tomcat-embed-logging-juli</artifactId>
 			<version>${tomcat.version}</version>
 			<scope>compile</scope>
 		</dependency>
+
+		<!-- SLF4J runtime -->
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>${slf4j.version}</version>
+		</dependency>
 	</dependencies>
 
 	<build>

File war-bootstrap-archetype/src/main/resources/archetype-resources/src/main/java/logging/CompactLogger.java

+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.logging;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+import org.slf4j.helpers.MarkerIgnoringBase;
+
+@SuppressWarnings("serial")
+public class CompactLogger extends MarkerIgnoringBase {
+
+	private static final String TRACE = "[TRACE] ";
+	private static final String DEBUG = "[DEBUG] ";
+	private static final String INFO = "[INFO] ";
+	private static final String WARN = "[WARNING] ";
+	private static final String ERROR = "[ERROR] ";
+
+	private final PrintStream writer;
+
+	public CompactLogger(String name, OutputStream output) {
+		this.name = name;
+
+		if (output == null) {
+			this.writer = System.out;
+
+		} else if (output instanceof PrintStream) {
+			this.writer = (PrintStream)output;
+
+		} else {
+			this.writer = new PrintStream(output, true);
+		}
+	}
+
+	@Override
+	public boolean isTraceEnabled() {
+		return CompactLoggerFactory.isTraceEnabled();
+	}
+
+	@Override
+	public boolean isDebugEnabled() {
+		return CompactLoggerFactory.isDebugEnabled();
+	}
+
+	@Override
+	public boolean isInfoEnabled() {
+		return CompactLoggerFactory.isInfoEnabled();
+	}
+
+	@Override
+	public boolean isWarnEnabled() {
+		return CompactLoggerFactory.isWarnEnabled();
+	}
+
+	@Override
+	public boolean isErrorEnabled() {
+		return CompactLoggerFactory.isErrorEnabled();
+	}
+
+	protected void write(String label, String msg) {
+		writer.println(label+msg);
+	}
+
+	protected void write(String label, String format, Object arg1) {
+		writer.format(label+format, arg1);
+		writer.println();
+	}
+
+	protected void write(String label, String format, Object arg1, Object arg2) {
+		writer.format(label+format, arg1, arg2);
+		writer.println();
+	}
+
+	protected void write(String label, String format, Object[] args) {
+		writer.format(label+format, args);
+		writer.println();
+	}
+
+	protected void write(String label, String msg, Throwable t) {
+		writer.println(label+msg);
+		writer.println(t.toString());
+	}
+
+	@Override
+	public void trace(String msg) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg);
+		}
+	}
+
+	@Override
+	public void trace(String msg, Object arg1) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg, arg1);
+		}
+	}
+
+	@Override
+	public void trace(String msg, Object arg1, Object arg2) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void trace(String msg, Object[] args) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg, args);
+		}
+	}
+
+	@Override
+	public void trace(String msg, Throwable t) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg, t);
+		}
+	}
+
+	@Override
+	public void debug(String msg) {
+		if (isDebugEnabled()) {
+			write(DEBUG, msg);
+		}
+	}
+
+	@Override
+	public void debug(String format, Object arg1) {
+		if (isDebugEnabled()) {
+			write(DEBUG, format, arg1);
+		}
+	}
+
+	@Override
+	public void debug(String format, Object arg1, Object arg2) {
+		if (isDebugEnabled()) {
+			write(DEBUG, format, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void debug(String format, Object[] args) {
+		if (isDebugEnabled()) {
+			write(DEBUG, format, args);
+		}
+	}
+
+	@Override
+	public void debug(String msg, Throwable t) {
+		if (isDebugEnabled()) {
+			write(DEBUG, msg, t);
+		}
+	}
+
+	@Override
+	public void info(String msg) {
+		if (isInfoEnabled()) {
+			write(INFO, msg);
+		}
+	}
+
+	@Override
+	public void info(String format, Object arg1) {
+		if (isInfoEnabled()) {
+			write(INFO, format, arg1);
+		}
+	}
+
+	@Override
+	public void info(String format, Object arg1, Object arg2) {
+		if (isInfoEnabled()) {
+			write(INFO, format, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void info(String format, Object[] args) {
+		if (isInfoEnabled()) {
+			write(INFO, format, args);
+		}
+	}
+
+	@Override
+	public void info(String msg, Throwable t) {
+		if (isInfoEnabled()) {
+			write(INFO, msg, t);
+		}
+	}
+
+	@Override
+	public void warn(String msg) {
+		if (isWarnEnabled()) {
+			write(WARN, msg);
+		}
+	}
+
+	@Override
+	public void warn(String format, Object arg1) {
+		if (isWarnEnabled()) {
+			write(WARN, format, arg1);
+		}
+	}
+
+	@Override
+	public void warn(String format, Object arg1, Object arg2) {
+		if (isWarnEnabled()) {
+			write(WARN, format, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void warn(String format, Object[] args) {
+		if (isWarnEnabled()) {
+			write(WARN, format, args);
+		}
+	}
+
+	@Override
+	public void warn(String msg, Throwable t) {
+		if (isWarnEnabled()) {
+			write(WARN, msg, t);
+		}
+	}
+
+	@Override
+	public void error(String msg) {
+		if (isErrorEnabled()) {
+			write(ERROR, msg);
+		}
+	}
+
+	@Override
+	public void error(String format, Object arg1) {
+		if (isErrorEnabled()) {
+			write(ERROR, format, arg1);
+		}
+	}
+
+	@Override
+	public void error(String format, Object arg1, Object arg2) {
+		if (isErrorEnabled()) {
+			write(ERROR, format, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void error(String format, Object[] args) {
+		if (isErrorEnabled()) {
+			write(ERROR, format, args);
+		}
+	}
+
+	@Override
+	public void error(String msg, Throwable t) {
+		if (isErrorEnabled()) {
+			write(ERROR, msg, t);
+		}
+	}
+}

File war-bootstrap-archetype/src/main/resources/archetype-resources/src/main/java/logging/CompactLoggerFactory.java

+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package ${package}.logging;
+
+import java.io.OutputStream;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.Logger;
+
+public class CompactLoggerFactory implements ILoggerFactory {
+
+	// set up logging defaults
+	private static boolean isTraceEnabled = false;
+	private static boolean isDebugEnabled = false;
+	private static boolean isInfoEnabled = true;
+	private static boolean isWarnEnabled = true;
+	private static boolean isErrorEnabled = true;
+
+	private static OutputStream output;
+
+	public static void setLoggerOutput(OutputStream output) {
+		CompactLoggerFactory.output = output;
+	}
+
+	@Override
+	public Logger getLogger(String name) {
+		return new CompactLogger(name, output);
+	}
+
+	public static boolean isTraceEnabled() {
+		return isTraceEnabled;
+	}
+
+	public static void setTraceEnabled(boolean value) {
+		isTraceEnabled = value;
+	}
+
+	public static boolean isDebugEnabled() {
+		return isDebugEnabled;
+	}
+
+	public static void setDebugEnabled(boolean value) {
+		isDebugEnabled = value;
+	}
+
+	public static boolean isInfoEnabled() {
+		return isInfoEnabled;
+	}
+
+	public static void setInfoEnabled(boolean value) {
+		isInfoEnabled = value;
+	}
+
+	public static boolean isWarnEnabled() {
+		return isWarnEnabled;
+	}
+
+	public static void setWarnEnabled(boolean value) {
+		isWarnEnabled = value;
+	}
+
+	public static boolean isErrorEnabled() {
+		return isErrorEnabled;
+	}
+
+	public static void setErrorEnabled(boolean value) {
+		isErrorEnabled = value;
+	}
+}

File war-bootstrap-archetype/src/main/resources/archetype-resources/src/main/java/org/slf4j/impl/StaticLoggerBinder.java

+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+package org.slf4j.impl;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.LoggerFactory;
+import org.slf4j.spi.LoggerFactoryBinder;
+
+import ${package}.logging.CompactLoggerFactory;
+
+/**
+ * The binding of {@link LoggerFactory} class with an actual instance of
+ * {@link ILoggerFactory} is performed using information returned by this class.
+ */
+public class StaticLoggerBinder implements LoggerFactoryBinder {
+
+	/**
+	 * The unique instance of this class.
+	 * 
+	 */
+	private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
+	
+	/**
+	 * Return the singleton of this class.
+	 * 
+	 * @return the StaticLoggerBinder singleton
+	 */
+	public static final StaticLoggerBinder getSingleton() {
+		return SINGLETON;
+	}
+
+	/**
+	 * Declare the version of the SLF4J API this implementation is compiled
+	 * against. The value of this field is usually modified with each release.
+	 */
+	// to avoid constant folding by the compiler, this field must *not* be final
+	public static String REQUESTED_API_VERSION = "1.6";	 // !final
+	
+	private static final String loggerFactoryClassStr = CompactLoggerFactory.class.getName();
+
+	/**
+	 * The ILoggerFactory instance returned by the {@link #getLoggerFactory}
+	 * method should always be the same object
+	 */
+	private final ILoggerFactory loggerFactory;
+	
+	private StaticLoggerBinder() {
+		loggerFactory = new CompactLoggerFactory();
+	}
+	
+	public ILoggerFactory getLoggerFactory() {
+		return loggerFactory;
+	}
+	
+	public String getLoggerFactoryClassStr() {
+		return loggerFactoryClassStr;
+	}		
+}

File war-bootstrap-archetype/src/main/resources/archetype-resources/src/main/java/org/slf4j/impl/StaticMDCBinder.java

+package org.slf4j.impl;
+
+import org.slf4j.helpers.NOPMDCAdapter;
+import org.slf4j.spi.MDCAdapter;
+
+/**
+ * This implementation is bound to {@link NOPMDCAdapter}.
+ */
+public class StaticMDCBinder {
+
+	/**
+	 * The unique instance of this class.
+	 */
+	public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
+
+	private StaticMDCBinder() {}
+	
+	/**
+	 * Currently this method always returns an instance of 
+	 * {@link StaticMDCBinder}.
+	 */
+	public MDCAdapter getMDCA() {
+		 return new NOPMDCAdapter();
+	}
+	
+	public String getMDCAdapterClassStr() {
+		return NOPMDCAdapter.class.getName();
+	}
+}

File war-bootstrap-archetype/src/main/resources/archetype-resources/src/main/java/org/slf4j/impl/StaticMarkerBinder.java

+package org.slf4j.impl;
+
+import org.slf4j.IMarkerFactory;
+import org.slf4j.MarkerFactory;
+import org.slf4j.helpers.BasicMarkerFactory;
+import org.slf4j.spi.MarkerFactoryBinder;
+
+/**
+ * 
+ * The binding of {@link MarkerFactory} class with an actual instance of 
+ * {@link IMarkerFactory} is performed using information returned by this class. 
+ */
+public class StaticMarkerBinder implements MarkerFactoryBinder {
+
+	/**
+	 * The unique instance of this class.
+	 */
+	public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();
+	
+	final IMarkerFactory markerFactory = new BasicMarkerFactory();
+	
+	private StaticMarkerBinder() {}
+	
+	/**
+	 * Currently this method always returns an instance of 
+	 * {@link BasicMarkerFactory}.
+	 */
+	public IMarkerFactory getMarkerFactory() {
+		return markerFactory;
+	}
+	
+	/**
+	 * Currently, this method returns the class name of
+	 * {@link BasicMarkerFactory}.
+	 */
+	public String getMarkerFactoryClassStr() {
+		return BasicMarkerFactory.class.getName();
+	}
+}

File war-bootstrap/pom.xml

 
 	<groupId>org.duelengine</groupId>
 	<artifactId>bootstrap</artifactId>
-	<version>0.3.0</version>
+	<version>0.3.1</version>
 	<packaging>jar</packaging>
 
 	<name>WAR Bootstrap</name>
 		<glassfish.version>3.1.1</glassfish.version>
 		<jetty.version>8.1.1.v20120215</jetty.version>
 		<tomcat.version>7.0.26</tomcat.version>
+		<slf4j.version>1.6.4</slf4j.version>
 		<javac.version>1.6</javac.version>
 	</properties>
 
 		<!-- NOTE: GlassFish and Tomcat appear to be conflicting.
 			 order appears to matter and also
 			 must set scope to provided if not used -->
+
+		<!-- Jetty 7/8 embedded runtime -->
 		<dependency>
-			<!-- Jetty 7/8 embedded runtime -->
 			<groupId>org.eclipse.jetty.aggregate</groupId>
 			<artifactId>jetty-all</artifactId>
 			<version>${jetty.version}</version>
 		</dependency>
+
+		<!-- GlassFish 3.1 embedded runtime -->
 		<dependency>
-			<!-- GlassFish 3.1 embedded runtime -->
 			<groupId>org.glassfish.extras</groupId>
 			<artifactId>glassfish-embedded-web</artifactId>
 			<version>${glassfish.version}</version>
 			<scope>provided</scope><!-- comment this for GF3 -->
 		</dependency>
+
+		<!-- Tomcat 7 embedded runtime -->
 		<dependency>
-			<!-- Tomcat 7 embedded runtime -->
 			<groupId>org.apache.tomcat.embed</groupId>
 			<artifactId>tomcat-embed-core</artifactId>
 			<version>${tomcat.version}</version>
 			<!--scope>compile</scope--><!-- comment this for TC7 -->
 		</dependency>
+
+		<!-- Tomcat 7 JSP -->
 		<dependency>
-			<!-- Tomcat 7 JSP -->
 			<groupId>org.apache.tomcat.embed</groupId>
 			<artifactId>tomcat-embed-jasper</artifactId>
 			<version>${tomcat.version}</version>
 			<scope>compile</scope>
 		</dependency>
+
+		<!-- Tomcat 7 logging -->
 		<dependency>
-			<!-- Tomcat 7 logging -->
 			<groupId>org.apache.tomcat.embed</groupId>
 			<artifactId>tomcat-embed-logging-juli</artifactId>
 			<version>${tomcat.version}</version>
 			<scope>compile</scope>
 		</dependency>
+
+		<!-- SLF4J runtime -->
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>${slf4j.version}</version>
+		</dependency>
 	</dependencies>
 
 	<build>

File war-bootstrap/src/main/java/org/duelengine/bootstrap/logging/CompactLogger.java

+package org.duelengine.bootstrap.logging;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+
+import org.slf4j.helpers.MarkerIgnoringBase;
+
+@SuppressWarnings("serial")
+public class CompactLogger extends MarkerIgnoringBase {
+
+	private static final String TRACE = "[TRACE] ";
+	private static final String DEBUG = "[DEBUG] ";
+	private static final String INFO = "[INFO] ";
+	private static final String WARN = "[WARNING] ";
+	private static final String ERROR = "[ERROR] ";
+
+	private final PrintStream writer;
+
+	public CompactLogger(String name, OutputStream output) {
+		this.name = name;
+
+		if (output == null) {
+			this.writer = System.out;
+
+		} else if (output instanceof PrintStream) {
+			this.writer = (PrintStream)output;
+
+		} else {
+			this.writer = new PrintStream(output, true);
+		}
+	}
+
+	@Override
+	public boolean isTraceEnabled() {
+		return CompactLoggerFactory.isTraceEnabled();
+	}
+
+	@Override
+	public boolean isDebugEnabled() {
+		return CompactLoggerFactory.isDebugEnabled();
+	}
+
+	@Override
+	public boolean isInfoEnabled() {
+		return CompactLoggerFactory.isInfoEnabled();
+	}
+
+	@Override
+	public boolean isWarnEnabled() {
+		return CompactLoggerFactory.isWarnEnabled();
+	}
+
+	@Override
+	public boolean isErrorEnabled() {
+		return CompactLoggerFactory.isErrorEnabled();
+	}
+
+	protected void write(String label, String msg) {
+		writer.println(label+msg);
+	}
+
+	protected void write(String label, String format, Object arg1) {
+		writer.format(label+format, arg1);
+		writer.println();
+	}
+
+	protected void write(String label, String format, Object arg1, Object arg2) {
+		writer.format(label+format, arg1, arg2);
+		writer.println();
+	}
+
+	protected void write(String label, String format, Object[] args) {
+		writer.format(label+format, args);
+		writer.println();
+	}
+
+	protected void write(String label, String msg, Throwable t) {
+		writer.println(label+msg);
+		writer.println(t.toString());
+	}
+
+	@Override
+	public void trace(String msg) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg);
+		}
+	}
+
+	@Override
+	public void trace(String msg, Object arg1) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg, arg1);
+		}
+	}
+
+	@Override
+	public void trace(String msg, Object arg1, Object arg2) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void trace(String msg, Object[] args) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg, args);
+		}
+	}
+
+	@Override
+	public void trace(String msg, Throwable t) {
+		if (isTraceEnabled()) {
+			write(TRACE, msg, t);
+		}
+	}
+
+	@Override
+	public void debug(String msg) {
+		if (isDebugEnabled()) {
+			write(DEBUG, msg);
+		}
+	}
+
+	@Override
+	public void debug(String format, Object arg1) {
+		if (isDebugEnabled()) {
+			write(DEBUG, format, arg1);
+		}
+	}
+
+	@Override
+	public void debug(String format, Object arg1, Object arg2) {
+		if (isDebugEnabled()) {
+			write(DEBUG, format, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void debug(String format, Object[] args) {
+		if (isDebugEnabled()) {
+			write(DEBUG, format, args);
+		}
+	}
+
+	@Override
+	public void debug(String msg, Throwable t) {
+		if (isDebugEnabled()) {
+			write(DEBUG, msg, t);
+		}
+	}
+
+	@Override
+	public void info(String msg) {
+		if (isInfoEnabled()) {
+			write(INFO, msg);
+		}
+	}
+
+	@Override
+	public void info(String format, Object arg1) {
+		if (isInfoEnabled()) {
+			write(INFO, format, arg1);
+		}
+	}
+
+	@Override
+	public void info(String format, Object arg1, Object arg2) {
+		if (isInfoEnabled()) {
+			write(INFO, format, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void info(String format, Object[] args) {
+		if (isInfoEnabled()) {
+			write(INFO, format, args);
+		}
+	}
+
+	@Override
+	public void info(String msg, Throwable t) {
+		if (isInfoEnabled()) {
+			write(INFO, msg, t);
+		}
+	}
+
+	@Override
+	public void warn(String msg) {
+		if (isWarnEnabled()) {
+			write(WARN, msg);
+		}
+	}
+
+	@Override
+	public void warn(String format, Object arg1) {
+		if (isWarnEnabled()) {
+			write(WARN, format, arg1);
+		}
+	}
+
+	@Override
+	public void warn(String format, Object arg1, Object arg2) {
+		if (isWarnEnabled()) {
+			write(WARN, format, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void warn(String format, Object[] args) {
+		if (isWarnEnabled()) {
+			write(WARN, format, args);
+		}
+	}
+
+	@Override
+	public void warn(String msg, Throwable t) {
+		if (isWarnEnabled()) {
+			write(WARN, msg, t);
+		}
+	}
+
+	@Override
+	public void error(String msg) {
+		if (isErrorEnabled()) {
+			write(ERROR, msg);
+		}
+	}
+
+	@Override
+	public void error(String format, Object arg1) {
+		if (isErrorEnabled()) {
+			write(ERROR, format, arg1);
+		}
+	}
+
+	@Override
+	public void error(String format, Object arg1, Object arg2) {
+		if (isErrorEnabled()) {
+			write(ERROR, format, arg1, arg2);
+		}
+	}
+
+	@Override
+	public void error(String format, Object[] args) {
+		if (isErrorEnabled()) {
+			write(ERROR, format, args);
+		}
+	}
+
+	@Override
+	public void error(String msg, Throwable t) {
+		if (isErrorEnabled()) {
+			write(ERROR, msg, t);
+		}
+	}
+}

File war-bootstrap/src/main/java/org/duelengine/bootstrap/logging/CompactLoggerFactory.java

+package org.duelengine.bootstrap.logging;
+
+import java.io.OutputStream;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.Logger;
+
+public class CompactLoggerFactory implements ILoggerFactory {
+
+	// set up logging defaults
+	private static boolean isTraceEnabled = false;
+	private static boolean isDebugEnabled = false;
+	private static boolean isInfoEnabled = true;
+	private static boolean isWarnEnabled = true;
+	private static boolean isErrorEnabled = true;
+
+	private static OutputStream output;
+
+	public static void setLoggerOutput(OutputStream output) {
+		CompactLoggerFactory.output = output;
+	}
+
+	@Override
+	public Logger getLogger(String name) {
+		return new CompactLogger(name, output);
+	}
+
+	public static boolean isTraceEnabled() {
+		return isTraceEnabled;
+	}
+
+	public static void setTraceEnabled(boolean value) {
+		isTraceEnabled = value;
+	}
+
+	public static boolean isDebugEnabled() {
+		return isDebugEnabled;
+	}
+
+	public static void setDebugEnabled(boolean value) {
+		isDebugEnabled = value;
+	}
+
+	public static boolean isInfoEnabled() {
+		return isInfoEnabled;
+	}
+
+	public static void setInfoEnabled(boolean value) {
+		isInfoEnabled = value;
+	}
+
+	public static boolean isWarnEnabled() {
+		return isWarnEnabled;
+	}
+
+	public static void setWarnEnabled(boolean value) {
+		isWarnEnabled = value;
+	}
+
+	public static boolean isErrorEnabled() {
+		return isErrorEnabled;
+	}
+
+	public static void setErrorEnabled(boolean value) {
+		isErrorEnabled = value;
+	}
+}

File war-bootstrap/src/main/java/org/slf4j/impl/StaticLoggerBinder.java

+package org.slf4j.impl;
+
+import org.slf4j.ILoggerFactory;
+import org.slf4j.LoggerFactory;
+import org.slf4j.spi.LoggerFactoryBinder;
+
+import org.duelengine.bootstrap.logging.CompactLoggerFactory;
+
+/**
+ * The binding of {@link LoggerFactory} class with an actual instance of
+ * {@link ILoggerFactory} is performed using information returned by this class.
+ */
+public class StaticLoggerBinder implements LoggerFactoryBinder {
+
+	/**
+	 * The unique instance of this class.
+	 * 
+	 */
+	private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
+	
+	/**
+	 * Return the singleton of this class.
+	 * 
+	 * @return the StaticLoggerBinder singleton
+	 */
+	public static final StaticLoggerBinder getSingleton() {
+		return SINGLETON;
+	}
+
+	/**
+	 * Declare the version of the SLF4J API this implementation is compiled
+	 * against. The value of this field is usually modified with each release.
+	 */
+	// to avoid constant folding by the compiler, this field must *not* be final
+	public static String REQUESTED_API_VERSION = "1.6";	 // !final
+	
+	private static final String loggerFactoryClassStr = CompactLoggerFactory.class.getName();
+
+	/**
+	 * The ILoggerFactory instance returned by the {@link #getLoggerFactory}
+	 * method should always be the same object
+	 */
+	private final ILoggerFactory loggerFactory;
+	
+	private StaticLoggerBinder() {
+		loggerFactory = new CompactLoggerFactory();
+	}
+	
+	public ILoggerFactory getLoggerFactory() {
+		return loggerFactory;
+	}
+	
+	public String getLoggerFactoryClassStr() {
+		return loggerFactoryClassStr;
+	}		
+}

File war-bootstrap/src/main/java/org/slf4j/impl/StaticMDCBinder.java

+package org.slf4j.impl;
+
+import org.slf4j.helpers.NOPMDCAdapter;
+import org.slf4j.spi.MDCAdapter;
+
+/**
+ * This implementation is bound to {@link NOPMDCAdapter}.
+ */
+public class StaticMDCBinder {
+
+	/**
+	 * The unique instance of this class.
+	 */
+	public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
+
+	private StaticMDCBinder() {}
+	
+	/**
+	 * Currently this method always returns an instance of 
+	 * {@link StaticMDCBinder}.
+	 */
+	public MDCAdapter getMDCA() {
+		 return new NOPMDCAdapter();
+	}
+	
+	public String getMDCAdapterClassStr() {
+		return NOPMDCAdapter.class.getName();
+	}
+}

File war-bootstrap/src/main/java/org/slf4j/impl/StaticMarkerBinder.java

+package org.slf4j.impl;
+
+import org.slf4j.IMarkerFactory;
+import org.slf4j.MarkerFactory;
+import org.slf4j.helpers.BasicMarkerFactory;
+import org.slf4j.spi.MarkerFactoryBinder;
+
+/**
+ * 
+ * The binding of {@link MarkerFactory} class with an actual instance of 
+ * {@link IMarkerFactory} is performed using information returned by this class. 
+ */
+public class StaticMarkerBinder implements MarkerFactoryBinder {
+
+	/**
+	 * The unique instance of this class.
+	 */
+	public static final StaticMarkerBinder SINGLETON = new StaticMarkerBinder();
+	
+	final IMarkerFactory markerFactory = new BasicMarkerFactory();
+	
+	private StaticMarkerBinder() {}
+	
+	/**
+	 * Currently this method always returns an instance of 
+	 * {@link BasicMarkerFactory}.
+	 */
+	public IMarkerFactory getMarkerFactory() {
+		return markerFactory;
+	}
+	
+	/**
+	 * Currently, this method returns the class name of
+	 * {@link BasicMarkerFactory}.
+	 */
+	public String getMarkerFactoryClassStr() {
+		return BasicMarkerFactory.class.getName();
+	}
+}