diff --git a/integration/build.xml b/integration/build.xml index 65bdc452..7b675cd5 100644 --- a/integration/build.xml +++ b/integration/build.xml @@ -21,6 +21,13 @@ + + + + + + + @@ -38,15 +45,24 @@ + + + + + + + + - + diff --git a/integration/lib/slf4j-simple-INCOMPATIBLE.jar b/integration/lib/slf4j-simple-INCOMPATIBLE.jar new file mode 100644 index 00000000..0f6b680f Binary files /dev/null and b/integration/lib/slf4j-simple-INCOMPATIBLE.jar differ diff --git a/integration/src/test/java/org/slf4j/Pre155VersionMismatchTest.java b/integration/src/test/java/org/slf4j/Pre155VersionTest.java similarity index 83% rename from integration/src/test/java/org/slf4j/Pre155VersionMismatchTest.java rename to integration/src/test/java/org/slf4j/Pre155VersionTest.java index 4c7248ef..1ab1f38c 100644 --- a/integration/src/test/java/org/slf4j/Pre155VersionMismatchTest.java +++ b/integration/src/test/java/org/slf4j/Pre155VersionTest.java @@ -5,13 +5,13 @@ import java.util.Random; 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); } diff --git a/integration/src/test/java/org/slf4j/VersionMismatchTest.java b/integration/src/test/java/org/slf4j/VersionMismatchTest.java new file mode 100644 index 00000000..d0f6b370 --- /dev/null +++ b/integration/src/test/java/org/slf4j/VersionMismatchTest.java @@ -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)); + + } +} diff --git a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java index ca2097b9..633ed8f0 100644 --- a/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java +++ b/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java @@ -128,7 +128,7 @@ public final class LoggerFactory { } 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."); } diff --git a/slf4j-site/src/site/pages/codes.html b/slf4j-site/src/site/pages/codes.html index 57ed3c46..3fd667aa 100644 --- a/slf4j-site/src/site/pages/codes.html +++ b/slf4j-site/src/site/pages/codes.html @@ -177,6 +177,10 @@ prefix=''; mismatch problem, it emits a warning about the said mismatch.

+

For the exact details of the version mismatch detection + mechanism, please refer to the relevant entry in the FAQ. +

Substitute loggers were created during the default configuration phase of the diff --git a/slf4j-site/src/site/pages/compatibility.html b/slf4j-site/src/site/pages/compatibility.html index 14dd000d..8e21e603 100644 --- a/slf4j-site/src/site/pages/compatibility.html +++ b/slf4j-site/src/site/pages/compatibility.html @@ -42,6 +42,9 @@ prefix=''; to suspect incompatible changes not mentioned here, please kindly contact the slf4j developers list.

+

Version 1.5.5 compared to 1.5.4

+ +

No breaking changes to report.

Version 1.5.4 compared to 1.5.3

diff --git a/slf4j-site/src/site/pages/faq.html b/slf4j-site/src/site/pages/faq.html index 5c1f30da..b829c150 100644 --- a/slf4j-site/src/site/pages/faq.html +++ b/slf4j-site/src/site/pages/faq.html @@ -990,46 +990,51 @@ class MyClass { SLF4J's version check mechanism work?
-

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 - not to participate, in which case, no version check - will be performed. +

The version check performed by SLF4J API during its + initialization is an elective process. Conforming SLF4J + implementations may choose not to participate, in + which case, no version check will be performed.

-

However, if you decide to participate, your SLF4J binding - needs to declare a variable called REQUESTED_API_VERSION - within your copy of the StaticLoggerBinder - 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.) +

However, if an SLF4J implementation decides to participate, + than it needs to declare a variable called + REQUESTED_API_VERSION within its copy of the + StaticLoggerBinder 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.

-

For earch version, SLF4J API maintains a list of compatible +

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.

-

As of SLF4J 1.5.5, 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.) +

As of SLF4J 1.5.5, 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.)

-

+

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.

diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html index 3a715e63..d6566ff8 100644 --- a/slf4j-site/src/site/pages/news.html +++ b/slf4j-site/src/site/pages/news.html @@ -27,13 +27,26 @@ prefix='';
+

October 17th, 2008 - Release of SLF4J 1.5.5

+ +

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 relevant entry + in the FAQ. +

+ +

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 compatibility + report. +

+

October 16th, 2008 - Release of SLF4J 1.5.4

-

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 compatibility report for this - version. +

This version corrects critical bugs.

Fixed