[slf4j-dev] svn commit: r427 - in slf4j/trunk: . src/java/org/slf4j/impl tests tests/input/log4j

ceki at slf4j.org ceki at slf4j.org
Mon Nov 21 12:58:07 CET 2005


Author: ceki
Date: Mon Nov 21 12:58:05 2005
New Revision: 427

Modified:
   slf4j/trunk/build.properties
   slf4j/trunk/src/java/org/slf4j/impl/Log4jLoggerAdapter.java
   slf4j/trunk/tests/build.xml
   slf4j/trunk/tests/input/log4j/basic.xml
Log:

- Fixed bug #5. See 

  http://bugzilla.slf4j.org/show_bug.cgi?id=5

for details.

- Preparing for the release of 1.0rc1

Modified: slf4j/trunk/build.properties
==============================================================================
--- slf4j/trunk/build.properties	(original)
+++ slf4j/trunk/build.properties	Mon Nov 21 12:58:05 2005
@@ -2,7 +2,7 @@
 # This properties file hold properties shared among several Ant
 # scripts
 
-version=1.0-beta9
+version=1.0-rc1
 
 jcl-version=104
 jcl.jar=jcl${jcl-version}-over-slf4j.jar
\ No newline at end of file

Modified: slf4j/trunk/src/java/org/slf4j/impl/Log4jLoggerAdapter.java
==============================================================================
--- slf4j/trunk/src/java/org/slf4j/impl/Log4jLoggerAdapter.java	(original)
+++ slf4j/trunk/src/java/org/slf4j/impl/Log4jLoggerAdapter.java	Mon Nov 21 12:58:05 2005
@@ -48,7 +48,13 @@
  */
 public final class Log4jLoggerAdapter implements Logger {
   final org.apache.log4j.Logger logger;
-
+  
+  /**
+   * Following the pattern discussed in pages 162 through 168 of 
+   * "The complete log4j manual".
+   */
+  final static String FQCN = Log4jLoggerAdapter.class.getName();
+  
   // WARN: Log4jLoggerAdapter constructor should have only package access so that
   // only Log4jLoggerFactory be able to create one.
   Log4jLoggerAdapter(org.apache.log4j.Logger logger) {
@@ -75,7 +81,7 @@
    * @param msg - the message object to be logged
    */
   public void debug(String msg) {
-    logger.debug(msg);
+    logger.log(FQCN, Level.DEBUG, msg, null);
   }
 
   /**
@@ -91,7 +97,7 @@
   public void debug(String format, Object arg) {
     if (logger.isDebugEnabled()) {
       String msgStr = MessageFormatter.format(format, arg);
-      logger.debug(msgStr);
+      logger.log(FQCN, Level.DEBUG, msgStr, null);
     }
   }
 
@@ -109,7 +115,7 @@
   public void debug(String format, Object arg1, Object arg2) {
     if (logger.isDebugEnabled()) {
       String msgStr = MessageFormatter.format(format, arg1, arg2);
-      logger.debug(msgStr);
+      logger.log(FQCN, Level.DEBUG, msgStr, null);
     }
   }
 
@@ -121,7 +127,7 @@
    * @param t the exception (throwable) to log
    */
   public void debug(String msg, Throwable t) {
-    logger.debug(msg, t);
+    logger.log(FQCN, Level.DEBUG, msg, t);
   }
 
   /**
@@ -140,7 +146,7 @@
    * @param msg - the message object to be logged
    */
   public void info(String msg) {
-    logger.info(msg);
+    logger.log(FQCN, Level.INFO, msg, null);
   }
 
   /**
@@ -156,7 +162,7 @@
   public void info(String format, Object arg) {
     if (logger.isInfoEnabled()) {
       String msgStr = MessageFormatter.format(format, arg);
-      logger.info(msgStr);
+      logger.log(FQCN, Level.INFO, msgStr, null);
     }
   }
 
@@ -174,7 +180,7 @@
   public void info(String format, Object arg1, Object arg2) {
     if (logger.isInfoEnabled()) {
       String msgStr = MessageFormatter.format(format, arg1, arg2);
-      logger.info(msgStr);
+      logger.log(FQCN, Level.INFO, msgStr, null);
     }
   }
 
@@ -186,7 +192,7 @@
    * @param t the exception (throwable) to log
    */
   public void info(String msg, Throwable t) {
-    logger.info(msg, t);
+    logger.log(FQCN, Level.INFO, msg, t);
   }
 
   /**
@@ -205,7 +211,7 @@
    * @param msg - the message object to be logged
    */
   public void warn(String msg) {
-    logger.warn(msg);
+    logger.log(FQCN, Level.WARN, msg, null);
   }
 
   /**
@@ -221,7 +227,7 @@
   public void warn(String format, Object arg) {
     if (logger.isEnabledFor(Level.WARN)) {
       String msgStr = MessageFormatter.format(format, arg);
-      logger.warn(msgStr);
+      logger.log(FQCN, Level.WARN, msgStr, null);
     }
   }
 
@@ -239,7 +245,7 @@
   public void warn(String format, Object arg1, Object arg2) {
     if (logger.isEnabledFor(Level.WARN)) {
       String msgStr = MessageFormatter.format(format, arg1, arg2);
-      logger.warn(msgStr);
+      logger.log(FQCN, Level.WARN, msgStr, null);
     }
   }
 
@@ -251,7 +257,7 @@
    * @param t the exception (throwable) to log
    */
   public void warn(String msg, Throwable t) {
-    logger.warn(msg, t);
+    logger.log(FQCN, Level.WARN, msg, t);
   }
 
   /**
@@ -270,7 +276,7 @@
    * @param msg - the message object to be logged
    */
   public void error(String msg) {
-    logger.error(msg);
+    logger.log(FQCN, Level.ERROR, msg, null);
   }
 
   /**
@@ -286,7 +292,7 @@
   public void error(String format, Object arg) {
     if (logger.isEnabledFor(Level.ERROR)) {
       String msgStr = MessageFormatter.format(format, arg);
-      logger.error(msgStr);
+      logger.log(FQCN, Level.ERROR, msgStr, null);
     }
   }
 
@@ -304,7 +310,7 @@
   public void error(String format, Object arg1, Object arg2) {
     if (logger.isEnabledFor(Level.ERROR)) {
       String msgStr = MessageFormatter.format(format, arg1, arg2);
-      logger.error(msgStr);
+      logger.log(FQCN, Level.ERROR, msgStr, null);
     }
   }
 
@@ -316,6 +322,6 @@
    * @param t the exception (throwable) to log
    */
   public void error(String msg, Throwable t) {
-    logger.error(msg, t);
+    logger.log(FQCN, Level.ERROR, msg, t);
   }
 }

Modified: slf4j/trunk/tests/build.xml
==============================================================================
--- slf4j/trunk/tests/build.xml	(original)
+++ slf4j/trunk/tests/build.xml	Mon Nov 21 12:58:05 2005
@@ -65,11 +65,23 @@
 		<pathelement location="../slf4j-log4j12.jar" />
 		<pathelement location="./lib/log4j-1.2.12.jar" />
 	</path>
-		
+
+	<path id="compatA.classpath">
+		<path refid="basic.classpath" />
+		<pathelement location="../slf4j-log4j13.jar" />
+		<pathelement location="./lib/log4j-1.2.12.jar" />
+	</path>
+
+	<path id="compatB.classpath">
+		<path refid="basic.classpath" />
+		<pathelement location="../slf4j-log4j12.jar" />
+		<pathelement location="../lib/log4j-1.3alpha-7.jar" />
+	</path>
+			
 	<path id="log4j13alpha7.classpath">
 		<path refid="basic.classpath" />
 		<pathelement location="../slf4j-log4j13.jar" />
-    	<pathelement location="./lib/log4j-1.3alpha-7.jar" />
+    	<pathelement location="../lib/log4j-1.3alpha-7.jar" />
 	</path>
 	
 	<!-- ================================================================= -->
@@ -188,7 +200,7 @@
 
 
 	<target name="InvokeLog4j12x" depends="build, slf4j-log4j12.jar, cleanOutputDir">
-		<copy file="input/log4j12x/basic.xml" tofile="${tests.javac.dest}/log4j.xml" />
+		<copy file="input/log4j/basic.xml" tofile="${tests.javac.dest}/log4j.xml" />
 		<junit printsummary="yes" fork="yes" haltonfailure="yes">
 			<classpath refid="log4j12x.classpath" />
 			<formatter type="plain" usefile="false" />
@@ -198,7 +210,7 @@
 	</target>
 
 	<target name="InvokeLog4j1212" depends="build, slf4j-log4j12.jar, cleanOutputDir">
-		<copy file="input/log4j12x/basic.xml" tofile="${tests.javac.dest}/log4j.xml" />
+		<copy file="input/log4j/basic.xml" tofile="${tests.javac.dest}/log4j.xml" />
 		<junit printsummary="yes" fork="yes" haltonfailure="yes">
 			<classpath refid="log4j1212.classpath" />
 			<formatter type="plain" usefile="false" />
@@ -209,6 +221,7 @@
 
 			
 	<target name="InvokeLog4j13alpha7" depends="build, slf4j-log4j13.jar, cleanOutputDir">
+		<copy file="input/log4j/basic.xml" tofile="${tests.javac.dest}/log4j.xml" />
 		<junit printsummary="yes" fork="yes" haltonfailure="yes">
 			<classpath refid="log4j13alpha7.classpath" />
 			<formatter type="plain" usefile="false" />
@@ -217,18 +230,27 @@
 		<delete file="${tests.javac.dest}/log4j.xml" />
 	</target>
 
-	<target name="CompatibilityLog4j" depends="build, slf4j-log4j13.jar, cleanOutputDir">
+	<target name="CompatibilityA" depends="build, slf4j-log4j13.jar, cleanOutputDir">
 		<junit printsummary="yes" fork="yes" haltonfailure="yes">
-			<classpath refid="log4j1212.classpath" />
+			<classpath refid="compatA.classpath" />
 			<formatter type="plain" usefile="false" />
 			<test name="org.slf4j.InvokingSLF4J" />
 		</junit>
 		<delete file="${tests.javac.dest}/log4j.xml" />
 	</target>
-	
+
+	<target name="CompatibilityB" depends="build, slf4j-log4j12.jar, cleanOutputDir">
+		<junit printsummary="yes" fork="yes" haltonfailure="yes">
+			<classpath refid="compatB.classpath" />
+			<formatter type="plain" usefile="false" />
+			<test name="org.slf4j.InvokingSLF4J" />
+		</junit>
+		<delete file="${tests.javac.dest}/log4j.xml" />
+	</target>
+			
 	<!-- NLOG4J -->
 	<target name="InvokeNLOG4J12x" depends="build, cleanOutputDir">
-		<copy file="input/log4j12x/basic.xml" tofile="${tests.javac.dest}/log4j.xml" />
+		<copy file="input/log4j/basic.xml" tofile="${tests.javac.dest}/log4j.xml" />
 		<junit printsummary="yes" fork="yes" haltonfailure="yes">
 			<classpath refid="nlog4j12x.classpath" />
 			<formatter type="plain" usefile="false" />

Modified: slf4j/trunk/tests/input/log4j/basic.xml
==============================================================================
--- slf4j/trunk/tests/input/log4j/basic.xml	(original)
+++ slf4j/trunk/tests/input/log4j/basic.xml	Mon Nov 21 12:58:05 2005
@@ -5,7 +5,7 @@
 
   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
     <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern"  value="%d %c - %m%n"/>  
+      <param name="ConversionPattern"  value="%d %c (%C:%L) - %m%n"/>  
     </layout>
   </appender>
     



More information about the slf4j-dev mailing list