From eb14bf43922852ee3a00ca552d9d56624f3fde79 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Fri, 17 Oct 2008 15:42:18 +0000 Subject: [PATCH] - better wording in the docs - improved integration tests: Added integration tests consistent with the elective version check policy --- integration/build.xml | 18 ++++- integration/lib/slf4j-simple-INCOMPATIBLE.jar | Bin 0 -> 7478 bytes ...smatchTest.java => Pre155VersionTest.java} | 4 +- .../java/org/slf4j/VersionMismatchTest.java | 43 ++++++++++++ .../main/java/org/slf4j/LoggerFactory.java | 2 +- slf4j-site/src/site/pages/codes.html | 4 ++ slf4j-site/src/site/pages/compatibility.html | 3 + slf4j-site/src/site/pages/faq.html | 63 ++++++++++-------- slf4j-site/src/site/pages/news.html | 23 +++++-- 9 files changed, 122 insertions(+), 38 deletions(-) create mode 100644 integration/lib/slf4j-simple-INCOMPATIBLE.jar rename integration/src/test/java/org/slf4j/{Pre155VersionMismatchTest.java => Pre155VersionTest.java} (83%) create mode 100644 integration/src/test/java/org/slf4j/VersionMismatchTest.java 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 0000000000000000000000000000000000000000..0f6b680f467cbdbd464805a12a2b0407987c968d GIT binary patch literal 7478 zcmb7JbzGF$_a5n#kdZ+`I;4gU3F#QgAqE6wXru%Nq@|=qQaS__qz04*1q3Cen+2p> zy8AcmuDY(f`}zLvd}iMH<2=uM?|aWZ=e*BRhoEEN0WOD7n1;yjfByWzMO{_ow4^wd zROPwV|1`q^2%^m14J)*XUI74d&;S6kznZB?sVd3KLAAJ4MKRI~rg?%$K z(pQ@Nb&aoJT-G*&|A-DV#Rsw$B|8@XG4gAQZ2tM5la9Wm2=S5P=^As~_Z3WJ%Mf^n z#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4XDvT2O-+uqJhR{eIei!2Y?nacO)xa{Ml9wC}LLbUJ=8{Hn*Jvf!WN^2V{Kp2;8j z{g0{sUE}{_0hgdlMEReHZ^7l?ahDVMWBe$dsTI!XUQ_mdj&SJr=ei~PX~A^4T`U*0MIN_yGb_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.

+

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