Replace JUL Level arguments with the corresponding method calls
Recipe ID
org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipesArtifactorg.openrewrite.recipe:rewrite-logging-frameworksReplace calls to Logger.log(Level, String) with the corresponding method calls.
Composite recipeMSAL
Add to your build
Get a download tokenThis recipe is Moderne licensed, so the token must belong to a Moderne customer. It replaces YOUR_DOWNLOAD_TOKEN below.
~/.gradle/gradle.properties
codeGenomeUsername=you@example.com
codeGenomeToken=YOUR_DOWNLOAD_TOKEN
build.gradle.kts
plugins {
id("org.openrewrite.rewrite") version("latest.release")
}
rewrite {
activeRecipe("org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes")
}
repositories {
mavenCentral()
maven {
url = uri("https://artifacts.codegenomeproject.org/maven")
credentials {
username = providers.gradleProperty("codeGenomeUsername").get()
password = providers.gradleProperty("codeGenomeToken").get()
}
}
}
dependencies {
rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:3.34.0")
}
Then run
./gradlew rewriteRunUsage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipesIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:RELEASEDefinition
This recipe runs the following recipes in order.
- Replace JUL
Logger.log(Level.FINEST, String)withLogger.finest(String)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelFinestToMethodRecipe - Replace JUL
Logger.log(Level.FINEST, Supplier<String>)withLogger.finest(Supplier<String>)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelFinestSupplierToMethodRecipe - Replace JUL
Logger.log(Level.FINER, String)withLogger.finer(String)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelFinerToMethodRecipe - Replace JUL
Logger.log(Level.FINER, Supplier<String>)withLogger.finer(Supplier<String>)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelFinerSupplierToMethodRecipe - Replace JUL
Logger.log(Level.FINE, String)withLogger.fine(String)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelFineToMethodRecipe - Replace JUL
Logger.log(Level.FINE, Supplier<String>)withLogger.fine(Supplier<String>)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelFineSupplierToMethodRecipe - Replace JUL
Logger.log(Level.INFO, String)withLogger.info(String)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelInfoToMethodRecipe - Replace JUL
Logger.log(Level.INFO, Supplier<String>)withLogger.info(Supplier<String>)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelInfoSupplierToMethodRecipe - Replace JUL
Logger.log(Level.WARNING, String)withLogger.warning(String)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelWarningToMethodRecipe - Replace JUL
Logger.log(Level.WARNING, Supplier<String>)withLogger.warning(Supplier<String>)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelWarningSupplierToMethodRecipe - Replace JUL
Logger.log(Level.SEVERE, String)withLogger.severe(String)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelSevereToMethodRecipe - Replace JUL
Logger.log(Level.SEVERE, Supplier<String>)withLogger.severe(Supplier<String>)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelSevereSupplierToMethodRecipe - Replace JUL
Logger.log(Level.CONFIG, String)withLogger.config(String)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelConfigToMethodRecipe - Replace JUL
Logger.log(Level.CONFIG, Supplier<String>)withLogger.config(Supplier<String>)org.openrewrite.java.logging.jul.LoggerLevelArgumentToMethodRecipes$LogLevelConfigSupplierToMethodRecipe
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats