Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewpreston-tr committed Mar 12, 2013
1 parent 67a67f4 commit 87b4999
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -262,7 +262,7 @@ private String getMessageI18N(LogRecord record) {
}
}
Object[] params = record.getParameters();
if (params != null) {
if (params != null && params.length > 0) {
message = MessageFormat.format(message, params);
}
return message;
Expand Down
Expand Up @@ -168,6 +168,17 @@ public void testLogWithResourceBundleWithParameters() {
assertEquals(expectedMsg3, le.getMessage());
}

public void testLogWithPlaceholderNoParameters() {
SLF4JBridgeHandler.install();
String msg = "msg {}";
julLogger.logp(Level.INFO, "SLF4JBridgeHandlerTest", "testLogWithPlaceholderNoParameters", msg, new Object[0]);

assertEquals(1, listAppender.list.size());
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
assertEquals(LOGGER_NAME, le.getLoggerName());
assertEquals(msg, le.getMessage());
}

void assertLevel(int index, org.apache.log4j.Level expectedLevel) {
LoggingEvent le = (LoggingEvent) listAppender.list.get(index);
assertEquals(expectedLevel, le.getLevel());
Expand Down

0 comments on commit 87b4999

Please sign in to comment.