[slf4j-dev] svn commit: r130 - in slf4j/trunk: . src/filtered-java/org/slf4j src/filtered-java/org/slf4j/impl src/java/org/slf4j src/java/org/slf4j/impl src/java/org/slf4j/spi tests/input/log4j tests/lib tests/src/java/org/slf4j tests/src/java/org/slf4j/impl

ceki at slf4j.org ceki at slf4j.org
Wed Jul 13 21:16:07 CEST 2005


Author: ceki
Date: Wed Jul 13 21:16:02 2005
New Revision: 130

Added:
   slf4j/trunk/src/filtered-java/org/slf4j/MarkerFactory.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/filtered-java/org/slf4j/MarkerFactory.java
   slf4j/trunk/src/java/org/slf4j/ILoggerFactory.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/ILoggerFactory.java
   slf4j/trunk/src/java/org/slf4j/IMarkerFactory.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/IMarkerFactory.java
   slf4j/trunk/src/java/org/slf4j/Marker.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/Marker.java
   slf4j/trunk/src/java/org/slf4j/Util.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/Util.java
   slf4j/trunk/src/java/org/slf4j/impl/BasicMarker.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/impl/BasicMarker.java
   slf4j/trunk/src/java/org/slf4j/impl/BasicMarkerFactory.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/impl/BasicMarkerFactory.java
   slf4j/trunk/src/java/org/slf4j/impl/JDK14LoggerAdapter.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/impl/JDK14LoggerAdapter.java
   slf4j/trunk/src/java/org/slf4j/impl/JDK14LoggerFactory.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/impl/JDK14LoggerFactory.java
   slf4j/trunk/src/java/org/slf4j/impl/NOPLoggerFactory.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/impl/NOPLoggerFactory.java
   slf4j/trunk/src/java/org/slf4j/impl/SimpleLoggerFactory.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/impl/SimpleLoggerFactory.java
   slf4j/trunk/src/java/org/slf4j/spi/
      - copied from r129, slf4j/branches/marker-experiment/src/java/org/slf4j/spi/
   slf4j/trunk/tests/input/log4j/
      - copied from r129, slf4j/branches/marker-experiment/tests/input/log4j/
   slf4j/trunk/tests/input/log4j/basic.xml
      - copied unchanged from r129, slf4j/branches/marker-experiment/tests/input/log4j/basic.xml
   slf4j/trunk/tests/lib/log4j-1.2.10.jar   (props changed)
      - copied unchanged from r129, slf4j/branches/marker-experiment/tests/lib/log4j-1.2.10.jar
   slf4j/trunk/tests/src/java/org/slf4j/MarkerTest.java
      - copied unchanged from r129, slf4j/branches/marker-experiment/tests/src/java/org/slf4j/MarkerTest.java
Removed:
   slf4j/trunk/src/filtered-java/org/slf4j/impl/
   slf4j/trunk/src/java/org/slf4j/LoggerFactoryAdapter.java
   slf4j/trunk/src/java/org/slf4j/impl/JDK14Logger.java
   slf4j/trunk/src/java/org/slf4j/impl/JDK14LoggerFA.java
   slf4j/trunk/src/java/org/slf4j/impl/NOPLoggerFA.java
   slf4j/trunk/src/java/org/slf4j/impl/SimpleLoggerFA.java
Modified:
   slf4j/trunk/build.xml
   slf4j/trunk/src/filtered-java/org/slf4j/LoggerFactory.java
   slf4j/trunk/src/java/org/slf4j/Constants.java
   slf4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java
   slf4j/trunk/tests/src/java/org/slf4j/SimpleLoggerFAFactory.java
   slf4j/trunk/tests/src/java/org/slf4j/XLoggerBySystemPropsTest.java
   slf4j/trunk/tests/src/java/org/slf4j/XLoggerFAFactory.java
   slf4j/trunk/tests/src/java/org/slf4j/impl/XLogger.java
   slf4j/trunk/tests/src/java/org/slf4j/impl/XLoggerFA.java
Log:

Merged https://svn.slf4j.org/repos/slf4j/branches/marker-experiment into trunk



Modified: slf4j/trunk/build.xml
==============================================================================
--- slf4j/trunk/build.xml	(original)
+++ slf4j/trunk/build.xml	Wed Jul 13 21:16:02 2005
@@ -28,7 +28,7 @@
       slf4j-nop.jar - build the jar file of the same name.
       slf4j-simple.jar - build the jar file of the same name.
       slf4j-jdk14.jar - build the jar file of the same name.
-      
+      jar - all of the above jar files
     </echo>
   </target>
 
@@ -71,13 +71,24 @@
         <include name="**/*.java"/>
       </fileset>
       <filterset><filter token="IMPL" value="${IMPL}"/></filterset>
+      <filterset>
+        <filter token="MARKER_FACTORY_IMPL_PREFIX" 
+                value="Basic"/>
+      </filterset>
+    </copy>
+
+    <copy todir="tmp/src">
+      <fileset dir="src/java">
+        <include name="**/*.java"/>
+      </fileset>
     </copy>
+
     
     <javac srcdir="${tmp.java.source.dir}"
            destdir="${tmp.javac.dest}"
            deprecation="on"
            includes="${SLF4J_STEM}/*.java,
-    	             ${SLF4J_STEM}/impl/MessageFormatter.java, 
+    	               ${SLF4J_STEM}/impl/MessageFormatter.java, 
                      ${SLF4J_STEM}/impl/${impl}*.class"
            debug="${debug}">
     </javac>
@@ -99,6 +110,7 @@
    
   </target>
 
+
   <target name="slf4j-nop.jar">
     <antcall target="slf4j-IMPL.jar">
       <param name="IMPL" value="NOP"/>

Modified: slf4j/trunk/src/filtered-java/org/slf4j/LoggerFactory.java
==============================================================================
--- slf4j/trunk/src/filtered-java/org/slf4j/LoggerFactory.java	(original)
+++ slf4j/trunk/src/filtered-java/org/slf4j/LoggerFactory.java	Wed Jul 13 21:16:02 2005
@@ -31,7 +31,6 @@
  */
 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
@@ -46,29 +45,29 @@
  * @author Ceki G&uuml;lc&uuml;
  */
 public class LoggerFactory {
-  static LoggerFactoryAdapter adapter;
+  static ILoggerFactory loggerFactory;
 
   // 
   // WARNING Do not modify copies but the original in
   //         $SLF4J_HOME/src/filtered-java/org/slf4j/
   //
   static {
-    String adapterClassStr = "org.slf4j.impl. at IMPL@LoggerFA";
-    System.out.println("SLF4J built for " + adapterClassStr);
+    String loggerFactoryClassStr = "org.slf4j.impl. at IMPL@LoggerFactory";
+    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. at IMPL@LoggerFA();
+          loggerFactory = new org.slf4j.impl. at IMPL@LoggerFactory();
       } 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);
       }
     }
@@ -77,35 +76,35 @@
   /**
    * Fetch the appropriate adapter 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,12 +112,6 @@
     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  {@link LoggerFactoryAdapter adapter}.
@@ -126,18 +119,10 @@
    * @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);
   }
 
   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: slf4j/trunk/src/java/org/slf4j/Constants.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/Constants.java	(original)
+++ slf4j/trunk/src/java/org/slf4j/Constants.java	Wed Jul 13 21:16:02 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
-	 * {@link LoggerFactory} class to use a specific factory adapter.
+	 * {@link 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: slf4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java	(original)
+++ slf4j/trunk/src/java/org/slf4j/impl/SimpleLogger.java	Wed Jul 13 21:16:02 2005
@@ -77,7 +77,7 @@
   static private String ERROR_STR = "ERROR";
   
   /**
-   * Package access allows only {@link SimpleLoggerFA} to instantiate 
+   * Package access allows only {@link SimpleLoggerFactory} to instantiate 
    * SimpleLogger instances.
    */
   SimpleLogger(String name) {

Modified: slf4j/trunk/tests/src/java/org/slf4j/SimpleLoggerFAFactory.java
==============================================================================
--- slf4j/trunk/tests/src/java/org/slf4j/SimpleLoggerFAFactory.java	(original)
+++ slf4j/trunk/tests/src/java/org/slf4j/SimpleLoggerFAFactory.java	Wed Jul 13 21:16:02 2005
@@ -31,11 +31,11 @@
  */
 package org.slf4j;
 
-import org.slf4j.impl.SimpleLoggerFA;
+import org.slf4j.impl.SimpleLoggerFactory;
 
 public class SimpleLoggerFAFactory {
 
-	public static LoggerFactoryAdapter getInstance() {
-		return new SimpleLoggerFA();
+	public static ILoggerFactory getInstance() {
+		return new SimpleLoggerFactory();
 	}
 }

Modified: slf4j/trunk/tests/src/java/org/slf4j/XLoggerBySystemPropsTest.java
==============================================================================
--- slf4j/trunk/tests/src/java/org/slf4j/XLoggerBySystemPropsTest.java	(original)
+++ slf4j/trunk/tests/src/java/org/slf4j/XLoggerBySystemPropsTest.java	Wed Jul 13 21:16:02 2005
@@ -39,7 +39,7 @@
 public class XLoggerBySystemPropsTest extends TestCase {
 
 	public void testBasic() {
-		System.setProperty(Constants.LOGGER_FA_FACTORY, "org.slf4j.XLoggerFAFactory");
+		System.setProperty(Constants.LOGGER_FA_FACTORY_PROPERTY, "org.slf4j.XLoggerFAFactory");
 		
 		Logger logger = LoggerFactory.getLogger("foo");
 		if(! (logger instanceof XLogger)) {

Modified: slf4j/trunk/tests/src/java/org/slf4j/XLoggerFAFactory.java
==============================================================================
--- slf4j/trunk/tests/src/java/org/slf4j/XLoggerFAFactory.java	(original)
+++ slf4j/trunk/tests/src/java/org/slf4j/XLoggerFAFactory.java	Wed Jul 13 21:16:02 2005
@@ -37,7 +37,7 @@
 
 public class XLoggerFAFactory {
 
-	public static LoggerFactoryAdapter getInstance() {
+	public static ILoggerFactory getInstance() {
 		return new XLoggerFA();
 	}
 }

Modified: slf4j/trunk/tests/src/java/org/slf4j/impl/XLogger.java
==============================================================================
--- slf4j/trunk/tests/src/java/org/slf4j/impl/XLogger.java	(original)
+++ slf4j/trunk/tests/src/java/org/slf4j/impl/XLogger.java	Wed Jul 13 21:16:02 2005
@@ -51,91 +51,67 @@
 
   public boolean isDebugEnabled() {  return false; }
 
-  public void debug(Object msg) {
+  public void debug(String msg) {
   }
 
-  public void debug(Object parameterizedMsg, Object param1) {  }
+  public void debug(String parameterizedMsg, Object arg) {  }
 
-  public void debug(String parameterizedMsg, Object param1, Object param2) {  }
+  public void debug(String parameterizedMsg, Object arg1, Object arg2) {  }
 
-  public void debug(Object msg, Throwable t) {  }
+  public void debug(String msg, Throwable t) {  }
 
   public boolean isInfoEnabled() {  return false;
   }
 
-  /* A NOP implementation.
-   * @see org.slf4j.Logger#info(java.lang.Object)
-   */
-  public void info(Object msg) {
+  public void info(String msg) {
     // NOP
   }
 
-  /* A NOP implementation.
-   * @see org.slf4j.Logger#info(java.lang.Object, java.lang.Object)
-   */
-  public void info(Object parameterizedMsg, Object param1) {
+  public void info(String format, Object arg) {
     // NOP
   }
 
-  /* A NOP implementation.
-   * @see org.slf4j.Logger#info(java.lang.Object, java.lang.Object, java.lang.Object)
-   */
-  public void info(String parameterizedMsg, Object param1, Object param2) {
+  public void info(String format, Object arg1, Object arg2) {
     // NOP
   }
 
-  /* A NOP implementation.
-   * @see org.slf4j.Logger#info(java.lang.Object, java.lang.Throwable)
-   */
-  public void info(Object msg, Throwable t) {
+  public void info(String msg, Throwable t) {
     // NOP
   }
 
-  /* Always returns false.
-   * @see org.slf4j.Logger#isWarnEnabled()
-   */
   public boolean isWarnEnabled() {
     return false;
   }
 
-  /* A NOP implementation.
-   * @see org.slf4j.Logger#warn(java.lang.Object)
-   */
-  public void warn(Object msg) {
+  public void warn(String msg) {
     // NOP
   }
 
-  /* A NOP implementation.
-   * @see org.slf4j.Logger#warn(java.lang.Object, java.lang.Object)
-   */
-  public void warn(Object parameterizedMsg, Object param1) {
+  public void warn(String format, Object arg) {
     // NOP
   }
 
-  /* A NOP implementation.
-   * @see org.slf4j.Logger#warn(java.lang.Object, java.lang.Object, java.lang.Object)
-   */
-  public void warn(String parameterizedMsg, Object param1, Object param2) {
+  public void warn(String format, Object arg1, Object arg2) {
     // NOP
   }
 
-  public void warn(Object msg, Throwable t) {
+  public void warn(String msg, Throwable t) {
   }
 
   public boolean isErrorEnabled() {
     return false;
   }
 
-  public void error(Object msg) {
+  public void error(String msg) {
   }
 
-  public void error(Object parameterizedMsg, Object param1) {
+  public void error(String format, Object arg) {
   }
 
-  public void error(String parameterizedMsg, Object param1, Object param2) {
+  public void error(String format, Object arg1, Object arg2) {
   }
 
-  public void error(Object msg, Throwable t) {
+  public void error(String msg, Throwable t) {
   }
 }
 

Modified: slf4j/trunk/tests/src/java/org/slf4j/impl/XLoggerFA.java
==============================================================================
--- slf4j/trunk/tests/src/java/org/slf4j/impl/XLoggerFA.java	(original)
+++ slf4j/trunk/tests/src/java/org/slf4j/impl/XLoggerFA.java	Wed Jul 13 21:16:02 2005
@@ -1,17 +1,17 @@
 
 package org.slf4j.impl;
 
-import org.slf4j.LoggerFactoryAdapter;
 import org.slf4j.Logger;
+import org.slf4j.ILoggerFactory;
 
 
 /**
- * NOPLoggerFA is am implementation of {@link LoggerFactoryAdapter}
+ * NOPLoggerFactory is am implementation of {@link ILoggerFactory}
  * which always returns the unique instance of NOPLogger.
  * 
  * @author Ceki Gulcu
  */
-public class XLoggerFA implements LoggerFactoryAdapter {
+public class XLoggerFA implements ILoggerFactory {
   
   public XLoggerFA() {
     // nothing to do



More information about the slf4j-dev mailing list