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

LoggingEvent#getFormattedMessage() doesn't format nulls the same way as SLF4J #31

Open
josephw opened this issue Dec 23, 2021 · 0 comments

Comments

@josephw
Copy link

josephw commented Dec 23, 2021

Although LoggingEvent#getFormattedMessage() isn't public (#28), its code is still usable as a reference. However, it doesn't present null values the same way as SLF4J, due to un-matched wrapping/unwrapping of Optional:

        LoggingEvent e = new LoggingEvent(Level.INFO, "Content: {}, {}", null, "value");
        System.out.println(MessageFormatter.arrayFormat(e.getMessage(), e.getArguments().toArray()).getMessage());

Produces:

Content: Optional.absent(), value

Rather than the expected:

Content: null, value
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

No branches or pull requests

1 participant