Author: ceki
Date: Mon Jul 18 21:21:04 2005
New Revision: 135

Modified:
   nlog4j/trunk/build.xml
   nlog4j/trunk/slf4j.xml
   nlog4j/trunk/src/java/org/apache/log4j/Logger.java
   nlog4j/trunk/src/java/org/slf4j/Constants.java
   nlog4j/trunk/src/java/org/slf4j/Logger.java
   nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java
   nlog4j/trunk/src/java/org/slf4j/impl/Log4jLoggerFactory.java
   nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java
   nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java
Log:

Aligning with SLF4J 1.0beta5



Modified: nlog4j/trunk/build.xml
==============================================================================
--- nlog4j/trunk/build.xml      (original)
+++ nlog4j/trunk/build.xml      Mon Jul 18 21:21:04 2005
@@ -10,7 +10,7 @@
   <!-- prefixed with "env". -->
   <property environment="env"/>
   
-  <property name="version" value="1.2.14"/>
+  <property name="version" value="1.2.15"/>
   
   <!-- The base directory relative to which most targets are built -->
   <property name="base" value="."/>

Modified: nlog4j/trunk/slf4j.xml
==============================================================================
--- nlog4j/trunk/slf4j.xml      (original)
+++ nlog4j/trunk/slf4j.xml      Mon Jul 18 21:21:04 2005
@@ -3,9 +3,6 @@
   <!-- The directory where source files are stored. -->
   <property name="java.source.dir" value="./src/java/"/>
 
-  <!-- Destination for compiled files -->
-  <property name="javac.dest" value="./classes"/>
-               
   <!-- ================================================================= -->
   <!-- Default target                                                    -->
   <!-- ================================================================= -->
@@ -34,17 +31,28 @@
     <delete>
       <fileset dir="src/java/org/slf4j" 
                includes="**/*.java"
-               excludes="impl/Log4jLoggerFA.java"/>
+               excludes="impl/Log4jLoggerFactory.java"/>
     </delete>
     
-    <!-- copy a filtered version of slf4j to src/java. Exclude JDK14
-         files because they will never be needed by NLOG4J -->
+    <!-- copy a filtered version of slf4j to src/java. -->
     <copy todir="src/java">
-      <fileset dir="src/filtered-java">
+      <fileset dir="src/slf4j/filtered-java">
         <include name="**/*.java"/>
-        <exclude name="**/impl/JDK14*.java"/>
       </fileset>
       <filterset><filter token="IMPL" value="Log4j"/></filterset>
+      <filterset>
+        <filter token="MARKER_FACTORY_IMPL_PREFIX" 
+                value="Basic"/>
+      </filterset>
+    </copy>
+
+   <!-- copy other invariable slf4j files to src/java. Exclude JDK14
+         files because they will never be needed by NLOG4J -->     
+    <copy todir="src/java">
+      <fileset dir="src/slf4j/java">
+        <include name="**/*.java"/>
+        <exclude name="**/impl/JDK14*.java"/>
+      </fileset>
     </copy>
   </target>
 
@@ -55,25 +63,25 @@
   <!-- Subversion Client Library" see http://www.tmate.org/svn/ for        -->
   <!-- details.                                                            -->
   <!--                                                                     -->
-  <!-- Note that we retrieve the sourc code into src/filtered-java/. It    -->
-  <!-- is the refresh-slf4j task defined above whicht will copy a filtered -->
+  <!-- Note that we retrieve the sourc code into src/slf4j/. The           -->
+  <!-- refresh-slf4j task defined above that will copy a filtered          -->
   <!-- and javac compatible version into src/java/.                        -->
   <!-- =================================================================== -->
 
   <target name="svnCheckout">
-    <delete dir="src/filtered-java/org/slf4j" />
+    <delete dir="src/slf4j/" />
 
-
-    <property name="repository.URL" 
value="http://svn.slf4j.org/repos/slf4j/trunk/src/filtered-java"/>
+    <property name="repository.URL" 
value="http://svn.slf4j.org/repos/slf4j/trunk/src/"/>
     <java classname="org.tmatesoft.svn.cli.SVN" dir="src/" fork="true">
       <arg value="co"/>
       <arg value="${repository.URL}"/>
-      <arg value="filtered-java"/>
+      <arg value="slf4j"/>
       <classpath>
         <pathelement location="lib/javasvn.jar" />
         <pathelement location="lib/javasvn-cli.jar" />
       </classpath>
     </java>
+
   </target>
        
 </project>

Modified: nlog4j/trunk/src/java/org/apache/log4j/Logger.java
==============================================================================
--- nlog4j/trunk/src/java/org/apache/log4j/Logger.java  (original)
+++ nlog4j/trunk/src/java/org/apache/log4j/Logger.java  Mon Jul 18 21:21:04 2005
@@ -8,7 +8,7 @@
 package org.apache.log4j;
 
 import org.apache.log4j.spi.LoggerFactory;
-
+import org.slf4j.Marker;
 
 /**
   This is the central class in the log4j package. Most logging
@@ -145,4 +145,84 @@
     return LogManager.getLogger(name, factory);
   }
 
+
+  public boolean isDebugEnabled(Marker marker) {
+    return isDebugEnabled();
+  }
+
+  public boolean isInfoEnabled(Marker marker) {
+    return isInfoEnabled();
+  }
+
+  public boolean isWarnEnabled(Marker marker) {
+     return isWarnEnabled();
+   }
+
+  public boolean isErrorEnabled(Marker marker) {
+   return isErrorEnabled();
+  }
+
+  public void debug(Marker marker, String msg) {
+    debug(msg);
+  } 
+
+  public void debug(Marker marker, String format, Object arg) {
+    debug(format, arg);
+  }
+
+  public void debug(Marker marker, String format, Object arg1, Object arg2) {
+    debug(format, arg1, arg2);
+  }
+
+  public void debug(Marker marker, String msg, Throwable t) {
+     debug(msg, t);
+  }
+
+  public void info(Marker marker, String msg) {
+    info(msg);
+  } 
+
+  public void info(Marker marker, String format, Object arg) {
+    info(format, arg);
+  }
+
+  public void info(Marker marker, String format, Object arg1, Object arg2) {
+    info(format, arg1, arg2);
+  }
+
+  public void info(Marker marker, String msg, Throwable t) {
+     info(msg, t);
+  }
+
+  public void warn(Marker marker, String msg) {
+    warn(msg);
+  } 
+
+  public void warn(Marker marker, String format, Object arg) {
+    warn(format, arg);
+  }
+
+  public void warn(Marker marker, String format, Object arg1, Object arg2) {
+    warn(format, arg1, arg2);
+  }
+
+  public void warn(Marker marker, String msg, Throwable t) {
+     warn(msg, t);
+  }
+
+  public void error(Marker marker, String msg) {
+    error(msg);
+  } 
+
+  public void error(Marker marker, String format, Object arg) {
+    error(format, arg);
+  }
+
+  public void error(Marker marker, String format, Object arg1, Object arg2) {
+    error(format, arg1, arg2);
+  }
+
+  public void error(Marker marker, String msg, Throwable t) {
+     error(msg, t);
+  }
 }

Modified: nlog4j/trunk/src/java/org/slf4j/Constants.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/Constants.java      (original)
+++ nlog4j/trunk/src/java/org/slf4j/Constants.java      Mon Jul 18 21:21:04 2005
@@ -36,19 +36,20 @@
  * Various constants used in the SLF4J API.
  */
 public interface Constants {
+    
        /**
         * The name of the system property to set in order to instruct
-        * [EMAIL PROTECTED] LoggerFactory} class to use a specific factory 
adapter.
+        * [EMAIL PROTECTED] LoggerFactory} class to use a specific 
ILoggerFactory.
         * <p>
         * This constant is currently set to the value "org.slf4j.factory".
         */
-       final public static String LOGGER_FA_FACTORY_PROPERTY = 
"org.slf4j.factory";
+       final public static String LOGGER_FACTORY_PROPERTY = 
"org.slf4j.factory";
        
        /**
-        * Constant used to determined the name of the factory method for
-        * creating factory adapters.
+        * Constant used to determine the name of the factory method for
+        * creating logger factories.
         * <p>
-        * This constant current is set to the value "getInstance".
+        * This constant currently is set to the value "getInstance".
         */
-       final public static String FA_FACTORY_METHOD_NAME = "getInstance";
+       final public static String LOGGER_FACTORY_FACTORY_METHOD_NAME = 
"getInstance";
 }

Modified: nlog4j/trunk/src/java/org/slf4j/Logger.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/Logger.java (original)
+++ nlog4j/trunk/src/java/org/slf4j/Logger.java Mon Jul 18 21:21:04 2005
@@ -48,7 +48,8 @@
    * false otherwise.
    */
   public boolean isDebugEnabled();
-  
+
+  public boolean isDebugEnabled(Marker marker);
   /**
    * Log a message at the DEBUG level.
    *
@@ -56,6 +57,14 @@
    */
   public void debug(String msg);
   
+
+  /**
+   * Log a message with the specific Marker at the DEBUG level.
+   * 
+   * @param marker The marker specific for this log statement
+   * @param msg the message string to be logged
+   */
+  public void debug(Marker marker, String msg);
   
   /**
    * Log a message at the DEBUG level according to the specified format
@@ -69,6 +78,8 @@
    */
   public void debug(String format, Object arg);
 
+  public void debug(Marker marker, String format, Object arg);
+  
   /**
    * Log a message at the DEBUG level according to the specified format
    * and arguments.
@@ -82,6 +93,8 @@
    */
   public void debug(String format, Object arg1, Object arg2);
 
+  public void debug(Marker marker, String format, Object arg1, Object arg2);
+ 
 
   /**
    * Log an exception (throwable) at the DEBUG level with an
@@ -92,7 +105,8 @@
    */ 
   public void debug(String msg, Throwable t);
   
-
+  public void debug(Marker marker, String msg, Throwable t);
+  
   /**
    * Is the logger instance enabled for the INFO level?
    * @return True if this Logger is enabled for the INFO level,
@@ -100,12 +114,17 @@
    */
   public boolean isInfoEnabled();
 
+  public boolean isInfoEnabled(Marker marker);
+  
   /**
    * Log a message at the INFO level.
    *
    * @param msg the message string to be logged
    */
   public void info(String msg);
+  
+  public void info(Marker marker, String msg);
+  
 
   /**
    * Log a message at the INFO level according to the specified format
@@ -141,6 +160,11 @@
    */
   public void info(String msg, Throwable t);
 
+  public void info(Marker marker, String format, Object arg);
+  public void info(Marker marker, String format, Object arg1, Object arg2);  
+  public void info(Marker marker, String msg, Throwable t); 
+
+  
   /**
    * Is the logger instance enabled for the WARN level?
    * @return True if this Logger is enabled for the WARN level,
@@ -189,6 +213,12 @@
    */
   public void warn(String msg, Throwable t);
 
+  public void warn(Marker marker, String msg); 
+  public void warn(Marker marker, String format, Object arg);
+  public void warn(Marker marker, String format, Object arg1, Object arg2);  
+  public void warn(Marker marker, String msg, Throwable t); 
+  public boolean isWarnEnabled(Marker marker);
+
   /**
    * Is the logger instance enabled for the ERROR level?
    * @return True if this Logger is enabled for the ERROR level,
@@ -237,4 +267,10 @@
    */
   public void error(String msg, Throwable t);
 
+  public void error(Marker marker, String msg); 
+  public void error(Marker marker, String format, Object arg);
+  public void error(Marker marker, String format, Object arg1, Object arg2);  
+  public void error(Marker marker, String msg, Throwable t); 
+  public boolean isErrorEnabled(Marker marker);
+
 }

Modified: nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java  (original)
+++ nlog4j/trunk/src/java/org/slf4j/LoggerFactory.java  Mon Jul 18 21:21:04 2005
@@ -31,81 +31,91 @@
  */
 package org.slf4j;
 
-
 // WARNING
 // WARNING Modifications MUST be made to the original file found at
 // WARNING $SLF4J_HOME/src/filtered-java/org/slf4j/LoggerFactory.java
 // WARNING
 
 /**
- * The <code>LoggerFactory</code> can produce Loggers for various logging APIs,
- * most notably for log4j, JDK 1.4 logging. Other implemenations such as
- * [EMAIL PROTECTED] org.slf4j.impl.NOPLogger NOPLogger} and
+ * The <code>LoggerFactory</code> is a utility class producing Loggers 
+ * for various logging APIs, most notably for NLOG4J and JDK 1.4 logging. 
+ * Other implemenations such as [EMAIL PROTECTED] org.slf4j.impl.NOPLogger 
NOPLogger} and
  * [EMAIL PROTECTED] org.slf4j.impl.SimpleLogger SimpleLogger} are also 
supported.
  *
+ * <p><code>LoggerFactory</code> is essentially a wrapper around an 
+ * [EMAIL PROTECTED] ILoggerFactory} instance bound with 
<code>LoggerFactory</code> 
+ * at compile time.
+ * 
+ * <p>Please note that all methods in <code>LoggerFactory</code> are 
+ * static.
+ * 
  * @author Ceki G&uuml;lc&uuml;
  */
-public class LoggerFactory {
-  static LoggerFactoryAdapter adapter;
+public final class LoggerFactory {
+  static ILoggerFactory loggerFactory;
 
+  // private constructor prevents instantiation
+  private LoggerFactory() {
+  }
+  
   // 
   // WARNING Do not modify copies but the original in
   //         $SLF4J_HOME/src/filtered-java/org/slf4j/
   //
   static {
-    String adapterClassStr = "org.slf4j.impl.Log4jLoggerFA";
-    System.out.println("SLF4J built for " + adapterClassStr);
+    String loggerFactoryClassStr = "org.slf4j.impl.Log4jLoggerFactory";
+    System.out.println("SLF4J built for " + loggerFactoryClassStr);
 
-    adapter = getFactoryAdapterFromSystemProperties();
+    loggerFactory = getFactoryFromSystemProperties();
 
     // if could not get an adapter from the system properties,  bind statically
-    if (adapter != null) {
-       System.out.println("However, SLF4J will use 
["+adapter.getClass().getName()
-                       + "] adapter from system properties.");
+    if (loggerFactory != null) {
+       System.out.println("However, SLF4J will use 
["+loggerFactory.getClass().getName()
+                       + "] adapter factory from system properties.");
     } else {
       try {
-        adapter = new org.slf4j.impl.Log4jLoggerFA();
+          loggerFactory = new org.slf4j.impl.Log4jLoggerFactory();
       } catch (Exception e) {
         // we should never get here
-        reportFailure(
-          "Could not instantiate instance of class [" + adapterClassStr + "]",
+        Util.reportFailure(
+          "Could not instantiate instance of class [" + loggerFactoryClassStr 
+ "]",
           e);
       }
     }
   }
 
   /**
-   * Fetch the appropriate adapter as intructed by the system propties.
+   * Fetch the appropriate ILoggerFactory as intructed by the system propties.
    * 
-   * @return The appropriate LoggerFactoryAdapter as directed from the 
+   * @return The appropriate ILoggerFactory instance as directed from the 
    * system properties
    */
-  private static LoggerFactoryAdapter getFactoryAdapterFromSystemProperties() {
-    String faFactoryClassName = null;
+  private static ILoggerFactory getFactoryFromSystemProperties() {
+    String factoryFactoryClassName = null;
 
     try {
-      faFactoryClassName = 
System.getProperty(Constants.LOGGER_FA_FACTORY_PROPERTY);
-      if (faFactoryClassName == null) {
+      factoryFactoryClassName = 
System.getProperty(Constants.LOGGER_FACTORY_FACTORY_METHOD_NAME);
+      if (factoryFactoryClassName == null) {
         return null;
       }
 
-      Class faFactoryClass = Class.forName(faFactoryClassName);
+      Class factoryFactoryClass = Class.forName(factoryFactoryClassName);
       Class[] EMPTY_CLASS_ARRAY = {  };
-      java.lang.reflect.Method faFactoryMethod =
-        faFactoryClass.getDeclaredMethod(
-          Constants.FA_FACTORY_METHOD_NAME, EMPTY_CLASS_ARRAY);
-      LoggerFactoryAdapter adapter =
-        (LoggerFactoryAdapter) faFactoryMethod.invoke(null, null);
-      return adapter;
+      java.lang.reflect.Method factoryFactoryMethod =
+          factoryFactoryClass.getDeclaredMethod(
+          Constants.LOGGER_FACTORY_FACTORY_METHOD_NAME, EMPTY_CLASS_ARRAY);
+      ILoggerFactory loggerFactory =
+        (ILoggerFactory) factoryFactoryMethod.invoke(null, null);
+      return loggerFactory;
     } catch (Throwable t) {
-      if (faFactoryClassName == null) {
-        reportFailure(
-          "Failed to fetch " + Constants.LOGGER_FA_FACTORY_PROPERTY
+      if (factoryFactoryClassName == null) {
+        Util.reportFailure(
+          "Failed to fetch " + Constants.LOGGER_FACTORY_FACTORY_METHOD_NAME
           + " system property.", t);
       } else {
-        reportFailure(
-          "Failed to fetch LoggerFactoryAdapter using the "
-          + faFactoryClassName + " class.", t);
+          Util.reportFailure(
+          "Failed to fetch ILoggerFactory instnace using the "
+          + factoryFactoryClassName + " class.", t);
       }
     }
 
@@ -113,31 +123,25 @@
     return null;
   }
 
-  static void reportFailure(String msg, Throwable t) {
-    System.err.println(msg);
-    System.err.println("Reported exception follows.");
-    t.printStackTrace();
-  }
-
   /**
    * Return a logger named according to the name parameter using the 
-   * previously bound  [EMAIL PROTECTED] LoggerFactoryAdapter adapter}.
+   * statically bound  [EMAIL PROTECTED] ILoggerFactory} instance.
+   * 
    * @param name The name of the logger.
    * @return logger
    */
   public static Logger getLogger(String name) {
-    return adapter.getLogger(name);
-  }
-
-  public static Logger getLogger(String domainName, String subDomainName) {
-    return adapter.getLogger(domainName, subDomainName);
+    return loggerFactory.getLogger(name);
   }
 
+  /**
+   * Return a logger named corresponding to the class passed as parameter,
+   * using the statically bound  [EMAIL PROTECTED] ILoggerFactory} instance.
+   * 
+   * @param clazz the returned logger will be named after clazz 
+   * @return logger
+   */
   public static Logger getLogger(Class clazz) {
-    return adapter.getLogger(clazz.getName());
-  }
-
-  public static Logger getLogger(Class clazz, String subDomainName) {
-    return adapter.getLogger(clazz.getName(), subDomainName);
+    return loggerFactory.getLogger(clazz.getName());
   }
 }

Modified: nlog4j/trunk/src/java/org/slf4j/impl/Log4jLoggerFactory.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/impl/Log4jLoggerFactory.java        
(original)
+++ nlog4j/trunk/src/java/org/slf4j/impl/Log4jLoggerFactory.java        Mon Jul 
18 21:21:04 2005
@@ -17,7 +17,7 @@
 package org.slf4j.impl;
 
 import org.apache.log4j.LogManager;
-import org.slf4j.LoggerFactoryAdapter;
+import org.slf4j.ILoggerFactory;
 import org.slf4j.Logger;
 
 /**
@@ -26,9 +26,9 @@
  * @author Ceki G&uuml;lc&uuml;
  *
  */
-public class Log4jLoggerFA implements LoggerFactoryAdapter {
+public class Log4jLoggerFactory implements ILoggerFactory {
 
-  public Log4jLoggerFA() {
+  public Log4jLoggerFactory() {
   }
 
   /**
@@ -42,17 +42,5 @@
   public Logger getLogger(String name) {
     return LogManager.getLogger(name);  
   }
-
-  /**
-   * Get a [EMAIL PROTECTED] Logger} by domain and subdomain name, by 
delegating all work 
-   * to log4's [EMAIL PROTECTED] LogManager}.
-   * 
-   * <p>The implementation is trivial because log4j 
-   * [EMAIL PROTECTED] org.apache.log4j.Logger loggers} directly implement the 
-   * [EMAIL PROTECTED] Logger} interface.
-   */
-  public Logger getLogger(String domainName, String subDomainName) {
-    return LogManager.getLogger(domainName);  
-  }
 }
 

Modified: nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java (original)
+++ nlog4j/trunk/src/java/org/slf4j/impl/NOPLogger.java Mon Jul 18 21:21:04 2005
@@ -1,9 +1,9 @@
-/* 
+/*
  * Copyright (c) 2004-2005 SLF4J.ORG
  * Copyright (c) 2004-2005 QOS.ch
  *
  * All rights reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
  * "Software"), to  deal in  the Software without  restriction, including
@@ -13,7 +13,7 @@
  * copyright notice(s) and this permission notice appear in all copies of
  * the  Software and  that both  the above  copyright notice(s)  and this
  * permission notice appear in supporting documentation.
- * 
+ *
  * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
  * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
@@ -23,7 +23,7 @@
  * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
  * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- * 
+ *
  * Except as  contained in  this notice, the  name of a  copyright holder
  * shall not be used in advertising or otherwise to promote the sale, use
  * or other dealings in this Software without prior written authorization
@@ -34,27 +34,27 @@
 package org.slf4j.impl;
 
 import org.slf4j.Logger;
+import org.slf4j.Marker;
 
 
 /**
  * A direct NOP (no operation) implementation of [EMAIL PROTECTED] Logger}.
- * 
+ *
  * @author Ceki G&uuml;lc&uuml;
  */
-public class NOPLogger implements Logger {
-
+public final class NOPLogger implements Logger {
   /**
    * The unique instance of NOPLogger.
    */
-  public final static NOPLogger NOP_LOGGER = new NOPLogger();
-  
+  public static final NOPLogger NOP_LOGGER = new NOPLogger();
+
   /**
    * There is no point in creating multiple instances of NullLogger,
    * hence the private access modifier.
    */
   private NOPLogger() {
   }
-  
+
   /**
    * Always returns false.
    * @return always false
@@ -74,7 +74,7 @@
   }
 
   /** A NOP implementation.  */
-  public void debug(String format, Object arg1, Object arg2) {
+  public final void debug(String format, Object arg1, Object arg2) {
     // NOP
   }
 
@@ -93,16 +93,40 @@
   }
 
   /** A NOP implementation. */
+  public void debug(Marker marker, String msg) {
+  }
+
+  /** A NOP implementation. */
+  public void debug(Marker marker, String format, Object arg) {
+  }
+
+  /** A NOP implementation. */
+  public void debug(Marker marker, String format, Object arg1, Object arg2) {
+  }
+
+  /** A NOP implementation. */
+  public void debug(Marker marker, String msg, Throwable t) {
+  }
+
+  /**
+   * Always returns false.
+   * @return always false
+   */
+  public boolean isDebugEnabled(Marker marker) {
+    return false;
+  }
+
+  /** A NOP implementation. */
   public void info(String msg) {
     // NOP
   }
 
- /** A NOP implementation. */
+  /** A NOP implementation. */
   public void info(String format, Object arg1) {
     // NOP
   }
 
- /** A NOP implementation. */
+  /** A NOP implementation. */
   public void info(String format, Object arg1, Object arg2) {
     // NOP
   }
@@ -112,6 +136,26 @@
     // NOP
   }
 
+  /** A NOP implementation. */
+  public void info(Marker marker, String msg) {
+  }
+
+  /** A NOP implementation. */
+  public void info(Marker marker, String format, Object arg) {
+  }
+
+  /** A NOP implementation. */
+  public void info(Marker marker, String format, Object arg1, Object arg2) {
+  }
+
+  /** A NOP implementation. */
+  public void info(Marker marker, String msg, Throwable t) {
+  }
+
+  public boolean isInfoEnabled(Marker marker) {
+    return false;
+  }
+
   /**
    * Always returns false.
    * @return always false
@@ -141,16 +185,37 @@
   }
 
   /** A NOP implementation. */
+  public void warn(Marker marker, String msg) {
+  }
+
+  /** A NOP implementation. */
+  public void warn(Marker marker, String format, Object arg) {
+  }
+
+  /** A NOP implementation. */
+  public void warn(Marker marker, String format, Object arg1, Object arg2) {
+  }
+
+  /** A NOP implementation. */
+  public void warn(Marker marker, String msg, Throwable t) {
+  }
+
+  /** Always false. */
+  public boolean isWarnEnabled(Marker marker) {
+    return false;
+  }
+
+  /** A NOP implementation. */
   public boolean isErrorEnabled() {
     return false;
   }
 
-  /** A NOP implementation. */ 
+  /** A NOP implementation. */
   public void error(String msg) {
     // NOP
   }
 
-   /** A NOP implementation. */
+  /** A NOP implementation. */
   public void error(String format, Object arg1) {
     // NOP
   }
@@ -165,4 +230,24 @@
     // NOP
   }
 
+  /** A NOP implementation. */
+  public void error(Marker marker, String msg) {
+  }
+
+  /** A NOP implementation. */
+  public void error(Marker marker, String format, Object arg) {
+  }
+
+  /** A NOP implementation. */
+  public final void error(Marker marker, String format, Object arg1, Object 
arg2) {
+  }
+
+  /** A NOP implementation. */
+  public void error(Marker marker, String msg, Throwable t) {
+  }
+
+  /** A NOP implementation. */
+  public final boolean isErrorEnabled(Marker marker) {
+    return false;
+  }
 }

Modified: nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java
==============================================================================
--- nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java      (original)
+++ nlog4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java      Mon Jul 18 
21:21:04 2005
@@ -1,9 +1,9 @@
-/* 
+/*
  * Copyright (c) 2004-2005 SLF4J.ORG
  * Copyright (c) 2004-2005 QOS.ch
  *
  * All rights reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
  * "Software"), to  deal in  the Software without  restriction, including
@@ -13,7 +13,7 @@
  * copyright notice(s) and this permission notice appear in all copies of
  * the  Software and  that both  the above  copyright notice(s)  and this
  * permission notice appear in supporting documentation.
- * 
+ *
  * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
  * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
@@ -23,7 +23,7 @@
  * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
  * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- * 
+ *
  * Except as  contained in  this notice, the  name of a  copyright holder
  * shall not be used in advertising or otherwise to promote the sale, use
  * or other dealings in this Software without prior written authorization
@@ -34,6 +34,7 @@
 package org.slf4j.impl;
 
 import org.slf4j.Logger;
+import org.slf4j.Marker;
 
 
 /**
@@ -44,7 +45,7 @@
  * name, the level, logger name, and the message followed by the line
  * separator for the host.  In log4j terms it amounts to the "%r [%t]
  * %level %logger - %m%n" pattern.  *</p>
- * 
+ *
  * <p>Sample output follows.</p>
  * <pre>
 176 [main] INFO examples.Sort - Populating an array of 2 elements in reverse 
order.
@@ -58,32 +59,29 @@
         at org.log4j.examples.Sort.main(Sort.java:64)
 467 [main] INFO  examples.Sort - Exiting main method.
 </pre>
- * 
+ *
  * @author Ceki G&uuml;lc&uuml;
  */
 public class SimpleLogger implements Logger {
-
-  String loggerName;
-  
   /**
    * Mark the time when this class gets loaded into memory.
    */
-  static private long startTime = System.currentTimeMillis();
-  
-  public static final String LINE_SEPARATOR = 
System.getProperty("line.separator");
-  
-  static private String INFO_STR = "INFO";
-  static private String WARN_STR = "WARN";
-  static private String ERROR_STR = "ERROR";
-  
+  private static long startTime = System.currentTimeMillis();
+  public static final String LINE_SEPARATOR =
+    System.getProperty("line.separator");
+  private static String INFO_STR = "INFO";
+  private static String WARN_STR = "WARN";
+  private static String ERROR_STR = "ERROR";
+  String loggerName;
+
   /**
-   * Package access allows only [EMAIL PROTECTED] SimpleLoggerFA} to 
instantiate 
+   * Package access allows only [EMAIL PROTECTED] SimpleLoggerFactory} to 
instantiate
    * SimpleLogger instances.
    */
   SimpleLogger(String name) {
     this.loggerName = name;
   }
-  
+
   /**
    * Always returns false.
    * @return always false
@@ -92,7 +90,15 @@
     return false;
   }
 
-  /** 
+  /**
+   * Always returns false.
+   * @return always false
+   */
+  public boolean isDebugEnabled(Marker marker) {
+    return false;
+  }
+  
+  /**
    * A NOP implementation, as this logger is permanently disabled for
    * the DEBUG level.
    */
@@ -100,7 +106,7 @@
     // NOP
   }
 
-  /** 
+  /**
    * A NOP implementation, as this logger is permanently disabled for
    * the DEBUG level.
    */
@@ -108,7 +114,7 @@
     // NOP
   }
 
-  /** 
+  /**
    * A NOP implementation, as this logger is permanently disabled for
    * the DEBUG level.
    */
@@ -116,7 +122,7 @@
     // NOP
   }
 
-  /** 
+  /**
    * A NOP implementation, as this logger is permanently disabled for
    * the DEBUG level.
    */
@@ -124,36 +130,51 @@
     // NOP
   }
 
+  public void debug(Marker marker, String msg) {
+  }
+
+  public void debug(Marker marker, String format, Object arg) {
+    debug(format, arg);
+  }
+
+  public void debug(Marker marker, String format, Object arg1, Object arg2) {
+    debug(format, arg1, arg2);
+  }
+
+  public void debug(Marker marker, String msg, Throwable t) {
+    debug(msg, t);
+  }
+
   /**
    * This is our internal implementation for logging regular 
(non-parameterized)
    * log messages.
-   * 
+   *
    * @param level
    * @param message
    * @param t
    */
   private void log(String level, String message, Throwable t) {
     StringBuffer buf = new StringBuffer();
-    
-    long millis  = System.currentTimeMillis();
-    buf.append(millis-startTime);
-    
+
+    long millis = System.currentTimeMillis();
+    buf.append(millis - startTime);
+
     buf.append(" [");
     buf.append(Thread.currentThread().getName());
     buf.append("] ");
-    
+
     buf.append(level);
     buf.append(" ");
-    
+
     buf.append(loggerName);
     buf.append(" - ");
 
     buf.append(message);
 
     buf.append(LINE_SEPARATOR);
-    
+
     System.out.print(buf.toString());
-    if(t != null) {
+    if (t != null) {
       t.printStackTrace(System.out);
     }
     System.out.flush();
@@ -161,17 +182,18 @@
 
   /**
    * For formatted messages, first substitute arguments and then log.
-   * 
+   *
    * @param level
    * @param format
    * @param param1
    * @param param2
    */
-  private void formatAndLog(String level, String format, Object arg1, Object 
arg2) {
+  private void formatAndLog(
+    String level, String format, Object arg1, Object arg2) {
     String message = MessageFormatter.format(format, arg1, arg2);
     log(level, message, null);
   }
-  
+
   /**
    * Always returns true.
    */
@@ -180,6 +202,13 @@
   }
 
   /**
+   * Always returns true.
+   */
+  public boolean isInfoEnabled(Marker marker) {
+    return true;
+  }
+  
+  /**
    * A simple implementation which always logs messages of level INFO according
    * to the format outlined above.
    */
@@ -187,9 +216,8 @@
     log(INFO_STR, msg, null);
   }
 
-  
   /**
-   * Perform single parameter substituion before logging the message of level 
+   * Perform single parameter substituion before logging the message of level
    * INFO according to the format outlined above.
    */
   public void info(String format, Object arg) {
@@ -197,27 +225,49 @@
   }
 
   /**
-   * Perform double parameter substituion before logging the message of level 
+   * Perform double parameter substituion before logging the message of level
    * INFO according to the format outlined above.
    */
-  
   public void info(String format, Object arg1, Object arg2) {
     formatAndLog(INFO_STR, format, arg1, arg2);
   }
 
-  /** 
+  /**
    * Log a message of level INFO, including an exception.
    */
   public void info(String msg, Throwable t) {
     log(INFO_STR, msg.toString(), t);
   }
 
+  public void info(Marker marker, String msg) {
+    info(msg);
+  }
+
+  public void info(Marker marker, String format, Object arg) {
+    info(format, arg);
+  }
+
+  public void info(Marker marker, String format, Object arg1, Object arg2) {
+    info(format, arg1, arg2);
+  }
+
+  public void info(Marker marker, String msg, Throwable t) {
+    info(msg, t);
+  }
+
   /**
    * Always returns true.
    */
   public boolean isWarnEnabled() {
     return true;
   }
+  
+  /**
+   * Always returns true.
+   */
+  public boolean isWarnEnabled(Marker marker) {
+    return true;
+  }
 
   /**
    * A simple implementation which always logs messages of level WARN according
@@ -228,7 +278,7 @@
   }
 
   /**
-   * Perform single parameter substituion before logging the message of level 
+   * Perform single parameter substituion before logging the message of level
    * WARN according to the format outlined above.
    */
   public void warn(String format, Object arg) {
@@ -236,7 +286,7 @@
   }
 
   /**
-   * Perform double parameter substituion before logging the message of level 
+   * Perform double parameter substituion before logging the message of level
    * WARN according to the format outlined above.
    */
   public void warn(String format, Object arg1, Object arg2) {
@@ -250,6 +300,22 @@
     log(WARN_STR, msg.toString(), t);
   }
 
+  public void warn(Marker marker, String msg) {
+    warn(msg);
+  }
+
+  public void warn(Marker marker, String format, Object arg) {
+    warn(format, arg);
+  }
+
+  public void warn(Marker marker, String format, Object arg1, Object arg2) {
+    warn(format, arg1, arg2);
+  }
+
+  public void warn(Marker marker, String msg, Throwable t) {
+    warn(msg, t);
+  }
+
   /**
    * Always returns true.
    */
@@ -258,6 +324,13 @@
   }
 
   /**
+   * Always returns true.
+   */
+  public boolean isErrorEnabled(Marker marker) {
+    return true;
+  }
+
+  /**
    * A simple implementation which always logs messages of level ERROR 
acoording
    * to the format outlined above.
    */
@@ -265,9 +338,8 @@
     log(ERROR_STR, msg.toString(), null);
   }
 
-
   /**
-   * Perform single parameter substituion before logging the message of level 
+   * Perform single parameter substituion before logging the message of level
    * ERROR according to the format outlined above.
    */
   public void error(String format, Object arg) {
@@ -275,18 +347,33 @@
   }
 
   /**
-   * Perform double parameter substituion before logging the message of level 
+   * Perform double parameter substituion before logging the message of level
    * ERROR according to the format outlined above.
    */
   public void error(String format, Object arg1, Object arg2) {
     formatAndLog(ERROR_STR, format, arg1, arg2);
   }
 
-  /** 
+  /**
    * Log a message of level ERROR, including an exception.
    */
   public void error(String msg, Throwable t) {
     log(ERROR_STR, msg.toString(), t);
   }
 
+  public void error(Marker marker, String msg) {
+    error(msg);
+  }
+
+  public void error(Marker marker, String format, Object arg) {
+    error(format, arg);
+  }
+
+  public void error(Marker marker, String format, Object arg1, Object arg2) {
+    error(format, arg1, arg2);
+  }
+
+  public void error(Marker marker, String msg, Throwable t) {
+    error(msg, t);
+  }
 }
_______________________________________________
nlog4j-dev mailing list
[email protected]
http://slf4j.org/mailman/listinfo/nlog4j-dev

Reply via email to