slf4j
slf4j copied to clipboard
Platform Logging bridge should use MessageFormat but it's using String.format
java.lang.System.Logger.log is specified to accept the message format of MessageFormat. However, the current SLF4JPlatformLogger implementation uses String.format instead of MessageFormat. As a result, the current implementation cannot format the message correctly.
Expected and actual behavior
LoggerFinder finder = System.LoggerFinder.getLoggerFinder();
Logger systemLogger = finder.getLogger("smoke", null);
systemLogger.log(Level.INFO, "hello {0}", "world");
Expected output:
INFO smoke - hello world
Actual output:
INFO smoke - hello {0}
What this change does
This change replaces use of String.format by MessageFormat.format to comply the spec of Platform Logging.
Filed JIRA ticket SLF4J-529.
I ran into this @ceki and had to switch to formatting prior to logging. Please consider fixing this mistake.
Just checking to see if this PR is not yet merged for a reason or just busy?
I wonder about this one as well. It's a little inconvenient to deal with at the moment.