Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform Logging bridge should use MessageFormat but it's using String.format #273

Merged
merged 1 commit into from Aug 8, 2023

Conversation

miyakawataku
Copy link
Contributor

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.

…ogger.log

Signed-off-by: Taku Miyakawa <miyakawa.taku@gmail.com>
@miyakawataku
Copy link
Contributor Author

Filed JIRA ticket SLF4J-529.

@ben-manes
Copy link

I ran into this @ceki and had to switch to formatting prior to logging. Please consider fixing this mistake.

@rob-bygrave
Copy link

Just checking to see if this PR is not yet merged for a reason or just busy?

@SentryMan
Copy link

I wonder about this one as well. It's a little inconvenient to deal with at the moment.

@ceki ceki merged commit 0769bc8 into qos-ch:master Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants