From eb14bf43922852ee3a00ca552d9d56624f3fde79 Mon Sep 17 00:00:00 2001
From: Ceki Gulcu yL5i8Wg}^
zz^EmEPhbB|bD6+?(5U|x&EL}5H_m@fXx~_K{Nny+&Og)Jk4J_B_^06YgBl(5AFKXp
bx|h^HLYX=Q6YG+N2=&oHo#u8F4*>9gi7Rz$
literal 0
HcmV?d00001
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.
No breaking changes to report.
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.
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. +
+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.