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

Use SLF4J in logging guide #540

Open
mrts opened this issue Feb 10, 2024 · 1 comment
Open

Use SLF4J in logging guide #540

mrts opened this issue Feb 10, 2024 · 1 comment
Labels

Comments

@mrts
Copy link

mrts commented Feb 10, 2024

The following idiom is recommended in the logging guide:

if (log.isEnabled(Logger.Level.TRACE)) {
    log.trace("called method with: " + name);
}

SLF4J supports a feature called parameterized logging which achieves the same result in a more elegant and succinct way on one line:

log.trace("called method with: {}", name);

As SLF4J binding to JBoss Logging is provided by Wildfly by default, I suggest that we recommend to use SLF4J in the logging guide instead to advocate clean code. Here is the corresponding adapter that proves that the two code snippets above are equivalent.

@hpehl
Copy link
Contributor

hpehl commented Feb 15, 2024

Thanks for the hint @mrts. I've opened #541 to get this merged.

@fjuma fjuma added the guide label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants