codegenomeproject
Search
MarketplaceModules
PackagesCLIMCP
Sign in
  1. Marketplace
  2. Java
  3. Logging
  4. SLF4J best practices

SLF4J best practices

MSAL

Applies best practices to logging with SLF4J.

org.openrewrite.java.logging.slf4j.Slf4jBestPractices
mod run . --recipe=org.openrewrite.java.logging.slf4j.Slf4jBestPractices

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

Recipe
  1. Unpack Logger method new Object[] {...} into varargs
  2. Loggers should be named for their enclosing classes
  3. SLF4J logging statements should begin with constants
  4. String.format() in logging statements should use SLF4J parameterized logging
  5. MessageFormat.format() in logging statements should use SLF4J parameterized logging
  6. Parameterize SLF4J's logging statements
  7. Enhances logging of exceptions by including the full stack trace in addition to the exception message
  8. Catch block log level
  9. Change logger fields to private
  10. Match if (is*Enabled()) with logging statements
  11. Optimize log statements
  12. Strip toString() from arguments
  13. Remove unnecessary log level guards
© Moderne, 2026
Recipe indexPrivacyTerms