mirror of https://github.com/qos-ch/slf4j
fix bug 212
This commit is contained in:
parent
8d30219371
commit
eaf1d80e60
|
|
@ -262,6 +262,8 @@ public class SLF4JBridgeHandler extends Handler {
|
|||
}
|
||||
}
|
||||
Object[] params = record.getParameters();
|
||||
// avoid formatting when there are no or 0 parameters. see also
|
||||
// http://bugzilla.slf4j.org/show_bug.cgi?id=212
|
||||
if (params != null && params.length > 0) {
|
||||
message = MessageFormat.format(message, params);
|
||||
}
|
||||
|
|
|
|||
2
jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerTest.java
Normal file → Executable file
2
jul-to-slf4j/src/test/java/org/slf4j/bridge/SLF4JBridgeHandlerTest.java
Normal file → Executable file
|
|
@ -170,7 +170,7 @@ public class SLF4JBridgeHandlerTest extends TestCase {
|
|||
|
||||
public void testLogWithPlaceholderNoParameters() {
|
||||
SLF4JBridgeHandler.install();
|
||||
String msg = "msg {}";
|
||||
String msg = "msg {non-number-string}";
|
||||
julLogger.logp(Level.INFO, "SLF4JBridgeHandlerTest", "testLogWithPlaceholderNoParameters", msg, new Object[0]);
|
||||
|
||||
assertEquals(1, listAppender.list.size());
|
||||
|
|
|
|||
|
|
@ -29,8 +29,15 @@
|
|||
|
||||
<hr noshade="noshade" size="1"/>
|
||||
|
||||
<h3> November, 2012 - Release of SLF4J 1.7.3</h3>
|
||||
<h3>13th of March, 2013 - Release of SLF4J 1.7.3</h3>
|
||||
|
||||
<p>The jul-to-slf4j bridge now correctly handles cases where the
|
||||
message string contains {}-placeholders but has no or zero
|
||||
parameters. This fixes <a
|
||||
href="http://bugzilla.slf4j.org/show_bug.cgi?id=212">bug
|
||||
#212</a>. The relevant patch was provided by Matthew Preston in a
|
||||
git pull request.</p>
|
||||
|
||||
<p>Added missing methods and classes in log4j-over-slf4j module for
|
||||
Velocity compatibility. This isssue was reported in <a
|
||||
href="http://bugzilla.slf4j.org/show_bug.cgi?id=280">bug 280</a> by
|
||||
|
|
|
|||
Loading…
Reference in New Issue