Migrate Log4j 2.x to SLF4J 1.x

MSAL

Transforms 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.Log4j2ToSlf4j1
mod run . --recipe=org.openrewrite.java.logging.slf4j.Log4j2ToSlf4j1

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. Change type LogManager to LoggerFactory
  2. Change method name org.apache.logging.log4j.Logger fatal(..) to error
  3. Change method name org.apache.logging.log4j.Category fatal(..) to error
  4. Replace Log4j 2.x active Level check with corresponding SLF4J method calls
  5. Change type org.apache.logging.log4j.Logger to org.slf4j.Logger
  6. Parameterize SLF4J's logging statements
  7. Replace any Lombok log annotations with target logging framework annotation