Replace JUL active Level check with corresponding SLF4J method calls

MSAL

Replace calls to Logger.isLoggable(Level) with the corresponding SLF4J method calls.

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

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.

  1. Replace JUL Logger.isLoggable(Level.ALL) with SLF4J's Logger.isTraceEnabled
  2. Replace JUL Logger.isLoggable(Level.FINEST) with SLF4J's Logger.isTraceEnabled
  3. Replace JUL Logger.isLoggable(Level.FINER) with SLF4J's Logger.isTraceEnabled()
  4. Replace JUL Logger.isLoggable(Level.FINE) with SLF4J's Logger.isDebugEnabled()
  5. Replace JUL Logger.isLoggable(Level.CONFIG) with SLF4J's Logger.isInfoEnabled()
  6. Replace JUL Logger.isLoggable(Level.INFO) with SLF4J's Logger.isInfoEnabled()
  7. Replace JUL Logger.isLoggable(Level.WARNING) with SLF4J's Logger.isWarnEnabled()
  8. Replace JUL Logger.isLoggable(Level.SEVERE) with SLF4J's Logger.isErrorEnabled()