Use lomboks log annotation instead of defining the field yourself
io.github.timoa.lombok.log.ConvertAnyLog
Applies all recipes that replace logger declarations with class level annotations. If you know which logger framework is in use you can simply use the specific recipe. If, for some reason you need to cover all frameworks you can use this recipe.
Usage
-
Maven POM
-
Maven Command Line
-
Gradle
-
Gradle init script
-
Add the following to your pom.xml file:
pom.xml<project> <build> <plugins> <plugin> <groupId>org.openrewrite.maven</groupId> <artifactId>rewrite-maven-plugin</artifactId> <version>6.12.1</version> <configuration> <activeRecipes> <recipe>io.github.timoa.lombok.log.ConvertAnyLog</recipe> </activeRecipes> </configuration> <dependencies> <dependency> <groupId>io.github.timo-a</groupId> <artifactId>rewrite-recipe-starter</artifactId> <version>0.4.2</version> </dependency> </dependencies> </plugin> </plugins> </build> </project> -
Run
mvn rewrite:runto run the recipe.
You will need to have Maven installed on your machine before you can run the following command.
Shell
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=io.github.timo-a:rewrite-recipe-starter:RELEASE -Drewrite.activeRecipes=io.github.timoa.lombok.log.ConvertAnyLog
-
Add the following to your
build.gradlefile:build.gradleplugins { id("org.openrewrite.rewrite") version("7.9.0") } rewrite { activeRecipe("io.github.timoa.lombok.log.ConvertAnyLog") } repositories { mavenCentral() } dependencies { rewrite("io.github.timo-a:rewrite-recipe-starter:0.4.2") } -
Run
gradle rewriteRunto run the recipe.
-
Create a file named
init.gradlein the root of your project.init.gradleinitscript { repositories { maven { url "https://plugins.gradle.org/m2" } } dependencies { classpath("org.openrewrite:plugin:7.9.0") } } rootProject { plugins.apply(org.openrewrite.gradle.RewritePlugin) dependencies { rewrite("io.github.timo-a:rewrite-recipe-starter:0.4.2") } rewrite { activeRecipe("io.github.timoa.lombok.log.ConvertAnyLog") } afterEvaluate { if (repositories.isEmpty()) { repositories { mavenCentral() } } } } -
Run
gradle --init-script init.gradle rewriteRunto run the recipe.
Definition
-
Recipe List
-
Yaml Recipe List
---
type: specs.openrewrite.org/v1beta/recipe
name: io.github.timoa.lombok.log.ConvertAnyLog
displayName: Use lomboks log annotation instead of defining the field yourself
description: >-
Applies all recipes that replace logger declarations with class level annotations.
If you know which logger framework is in use you can simply use the specific recipe.
If, for some reason you need to cover all frameworks you can use this recipe.
recipeList:
- io.github.timoa.lombok.log.ConvertSlf4j
- io.github.timoa.lombok.log.ConvertCommons
- io.github.timoa.lombok.log.ConvertLog4j2
- io.github.timoa.lombok.log.ConvertJBoss
- io.github.timoa.lombok.log.ConvertUtilLog