SLF4J Migrator

The SLF4J migrator is a small Java tool for migrating Java source files from the Jakarta Commons Logging (JCL) API to SLF4J. It can also migrate from the log4j API to SLF4J, or from java.util.logging API to SLF4J.

The SLF4J migrator consists of a single jar file which can be downloaded from here. The file can be launched as a stand-alone java application. Here is the command:

java -jar slf4j-migrator-2.0.13.jar

Once the application is launched, a window similar to the following should appear.


Use of the application should be self-explanatory. Please note that this migration tool does in-place replacement of Java files, meaning that there will be no back-up copies of modified files. It is your responsibility to back up your files before using SLF4J Migrator.


SLF4J migrator is intended as a simple tool to help you to migrate your project source using JCL, log4j or JUL to SLF4J. It can only perform elementary conversion steps. Essentially, it will replace appropriate import lines and logger declarations.

MyClass is a sample class using JCL. Here it is before:

package some.package; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public MyClass { Log logger = LogFactory.getLog(MyClass.class); public void someMethod() {"Hello world"); } }

and after migration:

package some.package; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public MyClass { Logger logger = LoggerFactory.getLogger(MyClass.class); public void someMethod() {"Hello world"); } }

Although its conversion rules are elementary, the SLF4J migrator can still alleviate much of the grunt-work involved in migrating a Java project from JCL to SLF4J.

Migration rules from log4j to SLF4J, or from JUL to SLF4J are similar.

General limitations

Limitations when migrating from log4j

Limitations when migrating from JUL