Migrate Log4j 2.x to SLF4J 1.x
MSALTransforms usages of Log4j 2.x to leveraging SLF4J 1.x directly. Note, this currently does not modify log4j.properties files.
org. openrewrite. java. logging. slf4j. Log4j2ToSlf4j1mod run . --recipe= org. openrewrite. java. logging. slf4j. Log4j2ToSlf4j1Install 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.
- Change type
LogManagertoLoggerFactory - Change method name
org.apache.logging.log4j.Logger fatal(..)toerror - Change method name
org.apache.logging.log4j.Category fatal(..)toerror - Replace Log4j 2.x active Level check with corresponding SLF4J method calls
- Change type
org.apache.logging.log4j.Loggertoorg.slf4j.Logger - Parameterize SLF4J's logging statements
- Replace any Lombok log annotations with target logging framework annotation