user1137387
user1137387

Reputation: 2043

log4j+commons-logging migration to Logback

We are using log4j+commons-logging in our current projects. Now we are mirgrating from log4j to Logback, so can we just use replace log4j.properties with logback.xml or we have to convert log4j to SLF4J?

Upvotes: 2

Views: 1680

Answers (1)

palacsint
palacsint

Reputation: 28865

You can use SLF4J and its log4j-over-slf4j module.

From the documentation:

log4j-over-slf4j

SLF4J ship with a module called log4j-over-slf4j. It allows log4j users to migrate existing applications to SLF4J without changing a single line of code but simply by replacing the log4j.jar file with log4j-over-slf4j.jar, as described below.

You also need Logback behind SLF4J and Logback configuration (logback.xml/logback.groovy etc.)

A similar module exists for commons-logging also. (See Gradual migration to SLF4J from Jakarta Commons Logging (JCL).)

Upvotes: 5

Related Questions