[slf4j-dev] [GIT] SLF4J: Simple Logging Facade for Java branch, master, updated. v1.5.11-19-gf590669
added by portage for gitosis-gentoo
git-noreply at pixie.qos.ch
Wed Apr 21 22:43:16 CEST 2010
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "SLF4J: Simple Logging Facade for Java".
The branch, master has been updated
via f590669b6523cf01f76e4b099b550fa98b9f9f68 (commit)
from 35ca85dfaa1c2933619f9eeef86c907223b55a96 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=slf4j.git;a=commit;h=f590669b6523cf01f76e4b099b550fa98b9f9f68
http://github.com/ceki/slf4j/commit/f590669b6523cf01f76e4b099b550fa98b9f9f68
commit f590669b6523cf01f76e4b099b550fa98b9f9f68
Author: Ceki Gulcu <ceki at qos.ch>
Date: Wed Apr 21 22:32:23 2010 +0200
- added test cases
- updated the docs
- preparing release 1.6.0-RC0
diff --git a/integration/pom.xml b/integration/pom.xml
index 2db3e77..0a6ff39 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/jcl-over-slf4j/pom.xml b/jcl-over-slf4j/pom.xml
index 8ed9f5c..42dbc0a 100644
--- a/jcl-over-slf4j/pom.xml
+++ b/jcl-over-slf4j/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/jcl104-over-slf4j/pom.xml b/jcl104-over-slf4j/pom.xml
index 42603e5..f26a645 100644
--- a/jcl104-over-slf4j/pom.xml
+++ b/jcl104-over-slf4j/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/jul-to-slf4j/pom.xml b/jul-to-slf4j/pom.xml
index d22f08d..9e6bb96 100644
--- a/jul-to-slf4j/pom.xml
+++ b/jul-to-slf4j/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/log4j-over-slf4j/pom.xml b/log4j-over-slf4j/pom.xml
index 0aa10cb..a26cabe 100644
--- a/log4j-over-slf4j/pom.xml
+++ b/log4j-over-slf4j/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/osgi-over-slf4j/pom.xml b/osgi-over-slf4j/pom.xml
index 0b4ac7f..8bd23cc 100644
--- a/osgi-over-slf4j/pom.xml
+++ b/osgi-over-slf4j/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/pom.xml b/pom.xml
index d2f5526..5be04a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
<packaging>pom</packaging>
<name>SLF4J</name>
diff --git a/slf4j-api/pom.xml b/slf4j-api/pom.xml
index b63ed1f..1876635 100644
--- a/slf4j-api/pom.xml
+++ b/slf4j-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java b/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java
index bd6dd17..c32ef16 100644
--- a/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java
+++ b/slf4j-api/src/main/java/org/slf4j/helpers/MessageFormatter.java
@@ -238,7 +238,7 @@ final public class MessageFormatter {
if (L < argArray.length - 1) {
return new FormattingTuple(sbuf.toString(), argArray, throwableCandidate);
} else {
- return new FormattingTuple(sbuf.toString());
+ return new FormattingTuple(sbuf.toString(), argArray, null);
}
}
diff --git a/slf4j-api/src/test/java/org/slf4j/helpers/MessageFormatterTest.java b/slf4j-api/src/test/java/org/slf4j/helpers/MessageFormatterTest.java
index 0d3c587..ae43ceb 100644
--- a/slf4j-api/src/test/java/org/slf4j/helpers/MessageFormatterTest.java
+++ b/slf4j-api/src/test/java/org/slf4j/helpers/MessageFormatterTest.java
@@ -33,6 +33,9 @@
package org.slf4j.helpers;
+import java.text.NumberFormat;
+import java.util.Arrays;
+
import junit.framework.TestCase;
/**
@@ -158,7 +161,7 @@ public class MessageFormatterTest extends TestCase {
assertEquals("Value {} is smaller than 1", result);
}
- public void testExceptionInToString() {
+ public void testExceptionIn_toString() {
Object o = new Object() {
public String toString() {
throw new IllegalStateException("a");
@@ -285,7 +288,8 @@ public class MessageFormatterTest extends TestCase {
{
Object[] cyclicA = new Object[1];
cyclicA[0] = cyclicA;
- assertEquals("[[...]]", MessageFormatter.arrayFormat("{}", cyclicA).getMessage());
+ assertEquals("[[...]]", MessageFormatter.arrayFormat("{}", cyclicA)
+ .getMessage());
}
{
Object[] a = new Object[2];
@@ -297,4 +301,69 @@ public class MessageFormatterTest extends TestCase {
"{}{}", a).getMessage());
}
}
+
+ public void testArrayThrowable() {
+ FormattingTuple ft;
+ Throwable t = new Throwable();
+ Object[] ia = new Object[] { i1, i2, i3, t };
+ Object[] iaWitness = new Object[] { i1, i2, i3 };
+
+ ft = MessageFormatter
+ .arrayFormat("Value {} is smaller than {} and {}.", ia);
+ assertEquals("Value 1 is smaller than 2 and 3.", ft.getMessage());
+ assertTrue(Arrays.equals(iaWitness, ft.getArgArray()));
+ assertEquals(t, ft.getThrowable());
+
+ ft = MessageFormatter.arrayFormat("{}{}{}", ia);
+ assertEquals("123", ft.getMessage());
+ assertTrue(Arrays.equals(iaWitness, ft.getArgArray()));
+ assertEquals(t, ft.getThrowable());
+
+ ft = MessageFormatter.arrayFormat("Value {} is smaller than {}.", ia);
+ assertEquals("Value 1 is smaller than 2.", ft.getMessage());
+ assertTrue(Arrays.equals(iaWitness, ft.getArgArray()));
+ assertEquals(t, ft.getThrowable());
+
+ ft = MessageFormatter.arrayFormat("Value {} is smaller than {}", ia);
+ assertEquals("Value 1 is smaller than 2", ft.getMessage());
+ assertTrue(Arrays.equals(iaWitness, ft.getArgArray()));
+ assertEquals(t, ft.getThrowable());
+
+ ft = MessageFormatter.arrayFormat("Val={}, {, Val={}", ia);
+ assertEquals("Val=1, {, Val=2", ft.getMessage());
+ assertTrue(Arrays.equals(iaWitness, ft.getArgArray()));
+ assertEquals(t, ft.getThrowable());
+
+ ft = MessageFormatter.arrayFormat("Val={}, \\{, Val={}", ia);
+ assertEquals("Val=1, \\{, Val=2", ft.getMessage());
+ assertTrue(Arrays.equals(iaWitness, ft.getArgArray()));
+ assertEquals(t, ft.getThrowable());
+
+ ft = MessageFormatter.arrayFormat("Val1={}, Val2={", ia);
+ assertEquals("Val1=1, Val2={", ft.getMessage());
+ assertTrue(Arrays.equals(iaWitness, ft.getArgArray()));
+ assertEquals(t, ft.getThrowable());
+
+ ft = MessageFormatter.arrayFormat(
+ "Value {} is smaller than {} and {} -- {} .", ia);
+ assertEquals("Value 1 is smaller than 2 and 3 -- " + t.toString() + " .",
+ ft.getMessage());
+ assertTrue(Arrays.equals(ia, ft.getArgArray()));
+ assertNull(ft.getThrowable());
+
+ ft = MessageFormatter.arrayFormat("{}{}{}{}", ia);
+ assertEquals("123" + t.toString(), ft.getMessage());
+ assertTrue(Arrays.equals(ia, ft.getArgArray()));
+ assertNull(ft.getThrowable());
+ }
+
+ public void testx() {
+ String s = "Hello world";
+ try {
+ Integer i = Integer.valueOf(s);
+ } catch (NumberFormatException e) {
+ System.out.println(e);
+ }
+ }
+
}
diff --git a/slf4j-ext/pom.xml b/slf4j-ext/pom.xml
index 1b5fbd8..9392550 100644
--- a/slf4j-ext/pom.xml
+++ b/slf4j-ext/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-jcl/pom.xml b/slf4j-jcl/pom.xml
index 450d816..a4a460f 100644
--- a/slf4j-jcl/pom.xml
+++ b/slf4j-jcl/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-jdk14/pom.xml b/slf4j-jdk14/pom.xml
index 1a93ac2..de8b16f 100644
--- a/slf4j-jdk14/pom.xml
+++ b/slf4j-jdk14/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-log4j12/pom.xml b/slf4j-log4j12/pom.xml
index de5c9c9..7db6199 100644
--- a/slf4j-log4j12/pom.xml
+++ b/slf4j-log4j12/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-migrator/pom.xml b/slf4j-migrator/pom.xml
index bcc9964..357e13b 100644
--- a/slf4j-migrator/pom.xml
+++ b/slf4j-migrator/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-nop/pom.xml b/slf4j-nop/pom.xml
index a4f6de8..7f68ce0 100644
--- a/slf4j-nop/pom.xml
+++ b/slf4j-nop/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-osgi-integration-test/pom.xml b/slf4j-osgi-integration-test/pom.xml
index cacda52..ccb165e 100644
--- a/slf4j-osgi-integration-test/pom.xml
+++ b/slf4j-osgi-integration-test/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-osgi-test-bundle/pom.xml b/slf4j-osgi-test-bundle/pom.xml
index c8d4d37..1e5ad78 100644
--- a/slf4j-osgi-test-bundle/pom.xml
+++ b/slf4j-osgi-test-bundle/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-simple/pom.xml b/slf4j-simple/pom.xml
index 61e866e..3bf74e2 100644
--- a/slf4j-simple/pom.xml
+++ b/slf4j-simple/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-site/pom.xml b/slf4j-site/pom.xml
index 565cbbb..f0cec49 100644
--- a/slf4j-site/pom.xml
+++ b/slf4j-site/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-parent</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.0-RC0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/slf4j-site/src/site/pages/download.html b/slf4j-site/src/site/pages/download.html
index 9125dc2..de0fe1a 100644
--- a/slf4j-site/src/site/pages/download.html
+++ b/slf4j-site/src/site/pages/download.html
@@ -46,10 +46,21 @@
<p>Download version ${project.version} including <i>full source code</i>,
class files and documentation in ZIP or TAR.GZ format: </p>
+ <h4>Stable version</h4>
+
+ <ul>
+ <li><a href="dist/slf4j-1.5.11.tar.gz"><b>slf4j-1.5.11.tar.gz</b></a> </li>
+ <li><a href="dist/slf4j-1.5.11.zip"><b>slf4j-1.5.11.zip</b></a> </li>
+ </ul>
+
+ <h4>Experimental</h4>
+
<ul>
<li><a href="dist/slf4j-${project.version}.tar.gz"><b>slf4j-${project.version}.tar.gz</b></a> </li>
<li><a href="dist/slf4j-${project.version}.zip"><b>slf4j-${project.version}.zip</b></a> </li>
</ul>
+
+
<h3>Previous versions</h3>
diff --git a/slf4j-site/src/site/pages/faq.html b/slf4j-site/src/site/pages/faq.html
index 84881c6..8a858f1 100644
--- a/slf4j-site/src/site/pages/faq.html
+++ b/slf4j-site/src/site/pages/faq.html
@@ -1109,50 +1109,33 @@ logger.debug("The new entry is {}.", entry);</pre>
<dd>
- <p>No. The SLF4J API does not support parametization in the
- presence of an exception. Thus,
+ <p>Yes, as of SLF4J 1.6.0, but not in previous versions. The
+ SLF4J API supports parametrization in the presence of an
+ exception, assuming the exception is the last parameter. Thus,
</p>
<pre class="prettyprint">String s = "Hello world";
try {
- throw new NumberFormatException("...");
+ Integer i = Integer.valueOf(s);
} catch (NumberFormatException e) {
logger.error("Failed to format {}", s, e);
}</pre>
- <p>will <b>NOT</b> print the <code>NumberFormatException</code> nor its
- stack trace. The java compiler will invoke the <a
- href="http://www.slf4j.org/apidocs/org/slf4j/Logger.html#error%28java.lang.String,%20java.lang.Object,%20java.lang.Object%29">error
- method taking a String and two Object arguments</a>, which,
- contrary to the programmer's most probable intention, will cause
- the <code>NumberFormatException</code> to be ignored. This is one
- of the unfortunate warts present in the SLF4J API.
- </p>
-
- <p>The only way to have the exception treated properly, is to
- invoke the <a
- href="http://www.slf4j.org/apidocs/org/slf4j/Logger.html#error%28java.lang.String,%20java.lang.Throwable%29">error
- method taking a String and a Throwable</a>. The correct code is
- then,</p>
-
- <pre class="prettyprint">String s = "Hello world";
-try {
- throw new NumberFormatException("...");
-} catch (NumberFormatException e) {
- // concatenation instead of parametrization!
- <b>logger.error("Failed to format "+ s, e);</b>
-}</pre>
+ <p>will print the <code>NumberFormatException</code> with its
+ stack trace as expected. The java compiler will invoke the <a
+ href="http://www.slf4j.org/apidocs/org/slf4j/Logger.html#error%28java.lang.String,%20java.lang.Object,%20java.lang.Object%29">error
+ method taking a String and two Object arguments</a>. SLF4J, in
+ accordance with the programmer's most probable intention, will
+ interpret <code>NumberFormatException</code> instance as a
+ throwable instead of an unused <code>Object</code> parameter. In
+ SLF4J versions prior to 1.6.0, the
+ <code>NumberFormatException</code> instance was simply ignored.
+ </p>
+
+ <p>If the exception is not the last argument, it will be treated
+ as a plain object and its stack trace will NOT be printed.
+ However, such situations should not occur in practice.
+ </p>
- <p>The second form MUST be employed in the presence of
- exceptions. Given that exceptions are rare by definition, the cost
- of concatenating "Failed format " and <em>s</em> should be
- negligible in pracice.
- </p>
-
- <p>If you are user of the SLF4J API, and do not understand the
- explanations in this question, you are advised to dwell on the
- matter until it becomes clear. You have been warned.
- </p>
-
</dd>
diff --git a/slf4j-site/src/site/pages/news.html b/slf4j-site/src/site/pages/news.html
index 796b504..45da6cc 100644
--- a/slf4j-site/src/site/pages/news.html
+++ b/slf4j-site/src/site/pages/news.html
@@ -29,7 +29,7 @@
<hr noshade="noshade" size="1"/>
- <h3>April Xth, 2010 - Release of SLF4J 1.6.0</h3>
+ <h3>April 21st, 2010 - Release of SLF4J 1.6.0-RC0</h3>
<p>It is expected that <em>all</em> SLF4J releases in the 1.6.x and
2.0.x series will be mutually compatible. Note that the 2.0.x
@@ -45,23 +45,11 @@
</p>
<p>In the presence of multiple parameters and if the last argument
- in a logging statement is an exception or more precisely of type
- <code>java.lang.Throwable</code>, then SLF4J will now presume that
- the user wants the last argument to be treated as an exception and
- not a simple parameters. For example, in the following catch
- clause:
- </p>
-
- <pre class="prettyprint">try {
- ..
- } catch(IOException e) {
- logger.error("Failed connect to {}", hostname, e);
- }</pre>
-
- <p>the <code>IOException</code> 'e' will now be treated as an
- exception and have its stack trace printed out. In previous
- versions of SLF4J, the exception was treated as an unused
- parameter. This fixes <a
+ in a logging statement is an exception, then SLF4J will now presume
+ that the user wants the last argument to be treated as an exception
+ and not a simple parameter. See the relevant <a
+ href="faq.html#paramException">FAQ entry</a> for further
+ details. This fixes <a
href="http://bugzilla.slf4j.org/show_bug.cgi?id=70">bug 70</a>
submitted by Joern Huxhorn who also provided the relevant patch.
</p>
-----------------------------------------------------------------------
Summary of changes:
integration/pom.xml | 2 +-
jcl-over-slf4j/pom.xml | 2 +-
jcl104-over-slf4j/pom.xml | 2 +-
jul-to-slf4j/pom.xml | 2 +-
log4j-over-slf4j/pom.xml | 2 +-
osgi-over-slf4j/pom.xml | 2 +-
pom.xml | 2 +-
slf4j-api/pom.xml | 2 +-
.../java/org/slf4j/helpers/MessageFormatter.java | 2 +-
.../org/slf4j/helpers/MessageFormatterTest.java | 73 +++++++++++++++++++-
slf4j-ext/pom.xml | 2 +-
slf4j-jcl/pom.xml | 2 +-
slf4j-jdk14/pom.xml | 2 +-
slf4j-log4j12/pom.xml | 2 +-
slf4j-migrator/pom.xml | 2 +-
slf4j-nop/pom.xml | 2 +-
slf4j-osgi-integration-test/pom.xml | 2 +-
slf4j-osgi-test-bundle/pom.xml | 2 +-
slf4j-simple/pom.xml | 2 +-
slf4j-site/pom.xml | 2 +-
slf4j-site/src/site/pages/download.html | 11 +++
slf4j-site/src/site/pages/faq.html | 55 +++++----------
slf4j-site/src/site/pages/news.html | 24 ++-----
23 files changed, 126 insertions(+), 75 deletions(-)
hooks/post-receive
--
SLF4J: Simple Logging Facade for Java
More information about the slf4j-dev
mailing list