[slf4j-dev] svn commit: r1205 - in slf4j/trunk: integration integration/lib integration/src/test/java/org/slf4j slf4j-api/src/main/java/org/slf4j slf4j-site/src/site/pages

ceki at slf4j.org ceki at slf4j.org
Fri Oct 17 17:42:18 CEST 2008


Author: ceki
Date: Fri Oct 17 17:42:18 2008
New Revision: 1205

Added:
   slf4j/trunk/integration/lib/slf4j-simple-INCOMPATIBLE.jar   (contents, props changed)
   slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionTest.java
      - copied, changed from r1204, /slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionMismatchTest.java
   slf4j/trunk/integration/src/test/java/org/slf4j/VersionMismatchTest.java
Removed:
   slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionMismatchTest.java
Modified:
   slf4j/trunk/integration/build.xml
   slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
   slf4j/trunk/slf4j-site/src/site/pages/codes.html
   slf4j/trunk/slf4j-site/src/site/pages/compatibility.html
   slf4j/trunk/slf4j-site/src/site/pages/faq.html
   slf4j/trunk/slf4j-site/src/site/pages/news.html

Log:
- better wording in the docs
- improved integration tests: Added integration tests consistent with the elective version check policy

Modified: slf4j/trunk/integration/build.xml
==============================================================================
--- slf4j/trunk/integration/build.xml	(original)
+++ slf4j/trunk/integration/build.xml	Fri Oct 17 17:42:18 2008
@@ -21,6 +21,13 @@
 		<pathelement location="./lib/slf4j-simple-1.5.0.jar" />
 	</path >
 
+	<path id="pathIncompatible">
+		<pathelement location="xtarget/classes/" />
+		<pathelement location="target/test-classes/" />
+		<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
+		<pathelement location="./lib/slf4j-simple-INCOMPATIBLE.jar" />
+	</path >
+			
 	<path id="pathCurrent">
 		<pathelement location="xtarget/classes/" />
 		<pathelement location="target/test-classes/" />
@@ -38,15 +45,24 @@
 	</target>
 
 	<target name="testAll" depends="init, 
+		            testMismatch, 
 		            testPre155,
 					testMatch">
 	</target>
 
+	<target name="testMismatch">
+		<junit printsummary="yes" fork="no" haltonfailure="yes">
+			<classpath refid="pathIncompatible" />
+			<formatter type="plain" />
+			<test fork="yes" todir="target/unit-reports" name="org.slf4j.VersionMismatchTest" />
+		</junit>
+	</target>
+		
 	<target name="testPre155">
 		<junit printsummary="yes" fork="no" haltonfailure="yes">
 			<classpath refid="path150" />
 			<formatter type="plain" />
-			<test fork="yes" todir="target/unit-reports" name="org.slf4j.Pre155VersionMismatchTest" />
+			<test fork="yes" todir="target/unit-reports" name="org.slf4j.Pre155VersionTest" />
 		</junit>
 	</target>
 

Added: slf4j/trunk/integration/lib/slf4j-simple-INCOMPATIBLE.jar
==============================================================================
Binary file. No diff available.

Copied: slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionTest.java (from r1204, /slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionMismatchTest.java)
==============================================================================
--- /slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionMismatchTest.java	(original)
+++ slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionTest.java	Fri Oct 17 17:42:18 2008
@@ -5,13 +5,13 @@
 
 import junit.framework.TestCase;
 
-public class Pre155VersionMismatchTest extends TestCase {
+public class Pre155VersionTest extends TestCase {
 
   StringPrintStream sps = new StringPrintStream(System.err);
   PrintStream old = System.err;
   int diff = 1024 + new Random().nextInt(10000);
 
-  public Pre155VersionMismatchTest(String name) {
+  public Pre155VersionTest(String name) {
     super(name);
   }
 

Added: slf4j/trunk/integration/src/test/java/org/slf4j/VersionMismatchTest.java
==============================================================================
--- (empty file)
+++ slf4j/trunk/integration/src/test/java/org/slf4j/VersionMismatchTest.java	Fri Oct 17 17:42:18 2008
@@ -0,0 +1,43 @@
+package org.slf4j;
+
+import java.io.PrintStream;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class VersionMismatchTest extends TestCase {
+
+  StringPrintStream sps = new StringPrintStream(System.err);
+  PrintStream old = System.err;
+  int diff = 1024 + new Random().nextInt(10000);
+
+  public VersionMismatchTest(String name) {
+    super(name);
+  }
+
+  protected void setUp() throws Exception {
+    super.setUp();
+    System.setErr(sps);
+  }
+
+  protected void tearDown() throws Exception {
+    super.tearDown();
+    System.setErr(old);
+  }
+
+  public void test() throws Exception {
+    Logger logger = LoggerFactory.getLogger(this.getClass());
+    String msg = "hello world " + diff;
+    logger.info(msg);
+    
+    String s0 = (String) sps.stringList.get(0);
+    assertTrue(s0.matches("SLF4J: The requested version .* by your slf4j binding is not compatible with.*"));
+
+    String s1 = (String) sps.stringList.get(1);
+    assertTrue(s1.contains(LoggerFactory.VERSION_MISMATCH));
+
+    String s2 = (String) sps.stringList.get(2);
+    assertTrue(s2.contains(msg));
+
+  }
+}

Modified: slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java
==============================================================================
--- slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java	(original)
+++ slf4j/trunk/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java	Fri Oct 17 17:42:18 2008
@@ -128,7 +128,7 @@
       }
       if (!match) {
         Util.reportFailure("The requested version " + requested
-            + " of your slf4j-binding does not match any of "
+            + " by your slf4j binding is not compatible with "
             + Arrays.toString(API_COMPATIBILITY_LIST));
         Util.reportFailure("See " + VERSION_MISMATCH + " for further details.");
       }

Modified: slf4j/trunk/slf4j-site/src/site/pages/codes.html
==============================================================================
--- slf4j/trunk/slf4j-site/src/site/pages/codes.html	(original)
+++ slf4j/trunk/slf4j-site/src/site/pages/codes.html	Fri Oct 17 17:42:18 2008
@@ -177,6 +177,10 @@
     mismatch problem, it emits a warning about the said mismatch.
     </p>
 
+    <p>For the exact details of the version mismatch detection
+    mechanism, please refer to the <a
+    href="faq.html#version_checks">relevant entry</a> in the FAQ.
+    </p>
 
     <h3><a name="substituteLogger" href="#substituteLogger">Substitute
     loggers were created during the default configuration phase of the

Modified: slf4j/trunk/slf4j-site/src/site/pages/compatibility.html
==============================================================================
--- slf4j/trunk/slf4j-site/src/site/pages/compatibility.html	(original)
+++ slf4j/trunk/slf4j-site/src/site/pages/compatibility.html	Fri Oct 17 17:42:18 2008
@@ -42,6 +42,9 @@
   to suspect incompatible changes not mentioned here, please kindly
   contact the slf4j developers list.</p>
 
+  <h2><a href="#1_5_5" name="1_5_4">Version 1.5.5 compared to 1.5.4</a></h2>
+  
+  <p>No breaking changes to report.</p>     
 
   <h2><a href="#1_5_4" name="1_5_4">Version 1.5.4 compared to 1.5.3</a></h2>
 

Modified: slf4j/trunk/slf4j-site/src/site/pages/faq.html
==============================================================================
--- slf4j/trunk/slf4j-site/src/site/pages/faq.html	(original)
+++ slf4j/trunk/slf4j-site/src/site/pages/faq.html	Fri Oct 17 17:42:18 2008
@@ -990,46 +990,51 @@
       SLF4J's version check mechanism work?</a></dt>
       
       <dd>
-        <p>Given its huge installed user base, the version check
-        performed by SLF4J API during its initialization is an
-        elective process. Conforming SLF4J implementations may choose
-        <em>not</em> to participate, in which case, no version check
-        will be performed.
+        <p>The version check performed by SLF4J API during its
+        initialization is an elective process. Conforming SLF4J
+        implementations may choose <em>not</em> to participate, in
+        which case, no version check will be performed.
         </p>
 
-        <p>However, if you decide to participate, your SLF4J binding
-        needs to declare a variable called REQUESTED_API_VERSION
-        within your copy of the <code>StaticLoggerBinder</code>
-        class. The value of this variable should be equal to the
-        version of the slf4j-api.jar you are compiling against. If you
-        ugrade to a newer version of slf4j-api, you also need to
-        update the value of REQUESTED_API_VERSION. (That is all you
-        have to do.)
+        <p>However, if an SLF4J implementation decides to participate,
+        than it needs to declare a variable called
+        REQUESTED_API_VERSION within its copy of the
+        <code>StaticLoggerBinder</code> class. The value of this
+        variable should be equal to the version of the slf4j-api.jar
+        it is compiled with. If the implementation is upgraded to a
+        newer version of slf4j-api, than you also need to update the
+        value of REQUESTED_API_VERSION. 
         </p>
 
-        <p>For earch version, SLF4J API maintains a list of compatible
+        <p>For each version, SLF4J API maintains a list of compatible
         versions. SLF4J will emit a version mismatch warning only if
         the requested version is not found in the compatibility
         list. So even if your SLF4J binding has a different release
-        schedule than SLF4J, you can still participate in the version
-        check without incurring a mismatch warning. For example,
-        logback has a different release schedule but still
+        schedule than SLF4J, assuming you update the SLF4J version you
+        use every 6 to 12 months, you can still participate in the
+        version check without incurring a mismatch warning. For
+        example, logback has a different release schedule but still
         participates in version checks.</p>
 
-        <p><b>As of SLF4J 1.5.5</b>, all bindings shipped within SLF4J
-        distribution, e.g. slf4j-logj12, slf4j-simple and slf4j-jdk14,
-        declare the REQUESTED_API_VERSION field with a value equal to
-        their SLF4J version. It follows that, for example if
-        slf4j-simple-1.5.6.jar is mixed with simple-api-1.5.5.jar,
-        then a version mismatch warning will be issued. Note that
-        SLF4J prior to 1.5.5 did not have a version check
-        mechanism. (Actually, version 1.5.4 offered a check policy
-        which was much too restritive and inconsistent with the size
-        of our user base. Consequently, SLF4J version 1.5.5 was
-        released just a day after 1.5.4.)
+        <p><b>As of SLF4J 1.5.5</b>, all bindings shipped within the
+        SLF4J distribution, e.g. slf4j-logj12, slf4j-simple and
+        slf4j-jdk14, declare the REQUESTED_API_VERSION field with a
+        value equal to their SLF4J version. It follows that, for
+        example if slf4j-simple-1.5.6.jar is mixed with
+        slf4j-api-1.5.5.jar, then a version mismatch warning will be
+        issued. Note that SLF4J versions prior to 1.5.5 did not have a
+        version check mechanism.  Only slf4j-api-1.5.5.jar and later
+        can emit version mismatch warnings. (Actually, version 1.5.4
+        offered a check policy which was much too restrictive and
+        inconsistent with the size of our user base. Consequently,
+        SLF4J version 1.5.5 was released just a day after 1.5.4.)
         </p>
         
-        <p>
+        <p>Given its huge installed user base and several external
+        implementations, it would have been unwise to expect all SLF4J
+        implementations to closely follow SLF4J's release schedule,
+        let alone align their release schedules with SLF4J. Hence, the
+        elective version check policy.
         </p>
        
       </dd>

Modified: slf4j/trunk/slf4j-site/src/site/pages/news.html
==============================================================================
--- slf4j/trunk/slf4j-site/src/site/pages/news.html	(original)
+++ slf4j/trunk/slf4j-site/src/site/pages/news.html	Fri Oct 17 17:42:18 2008
@@ -27,13 +27,26 @@
 
   <hr noshade="noshade" size="1"/>
 
+  <h3>October 17th, 2008 - Release of SLF4J 1.5.5</h3>
+
+  <p>The version check mechanims introduced in SLF4J 1.5.4 was
+  inconstent with the large size of SLF4J's installed user base.  We
+  cannot expect external SLF4J to align their release schedule with
+  that of SLF4J. Consequently, this SLF4J version, namely 1.5.5,
+  retains versions checks but as an elective process. For further
+  details see the <a href="faq.html#version_checks">relevant entry</a>
+  in the FAQ.
+  </p>
+
+  <p>You are highly encouraged to upgrade to SLF4J version 1.5.5. The
+  upgrade should pose no problems. Nevertheless, you might still want
+  to refer to the SLF4J <a href="compatibility.html">compatibility
+  report</a>.
+  </p>
+
   <h3>October 16th, 2008 - Release of SLF4J 1.5.4</h3>
 
-  <p>This version corrects critical bugs. You are highly encouraged to
-  upgrade to SLF4J version 1.5.4. The upgrade should pose no
-  problems. Nevertheless, you might still want to refer to the <a
-  href="compatibility.html#1_5_4">compatibility report</a> for this
-  version.
+  <p>This version corrects critical bugs.
   </p>
 
   <p>Fixed <a



More information about the slf4j-dev mailing list