[slf4j-dev] [Bug 221] New: MessageFormatter.format() not returning String
bugzilla-daemon at pixie.qos.ch
bugzilla-daemon at pixie.qos.ch
Wed Jun 1 11:48:38 CEST 2011
http://bugzilla.slf4j.org/show_bug.cgi?id=221
Summary: MessageFormatter.format() not returning String
Product: SLF4J
Version: 1.6.x
Platform: PC
OS/Version: Windows NT
Status: NEW
Severity: major
Priority: P1
Component: Core API
AssignedTo: slf4j-dev at qos.ch
ReportedBy: lorant.pinter at gmail.com
The MessageFormatter.format() method, according to its Javadoc, is supposed to
return a String, but it doesn't. Instead it returns a FormattingTuple for some
time.
I have this piece of code:
private void trace(String message, Object... args) {
if (log.isTraceEnabled(MARKER)) {
StringBuilder line = new StringBuilder();
line.append(Transaction.this);
final int holdCount = lock.getHoldCount();
line.append("(lvl ").append(holdCount).append(")");
for (int i = 0; i < holdCount; i++) {
line.append('\t');
}
line.append(" - ");
// **** Important bit here *****
line.append(MessageFormatter.format(message, args));
log.trace(MARKER, line.toString());
}
}
It used to work while MessageFormat.format() still returned a String before
1.6.0. Now it's printing something like this:
TRACE 56|242|c2 Transaction[0](lvl 2)
org.slf4j.helpers.FormattingTuple at 74dc6ad7
Now, that's not very helpful.
Please change the Javadoc to reflect that the returned value is not a string.
Please consider adding a .toString() method to FormattingTuple as well.
--
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the slf4j-dev
mailing list