0
votes

We have added libraries that use log4J 2.X, but we are still using log4J 1.X (mainly because we have our own impl of some Appenders and Loggers). I was told that the solution is to send log4J 2.X to slf4j (using log4j-to-slf4j, version 2.X), and then slf4j to log4J 1.X, using slf4j-log4j12, version 1.X.

This is what I have just done, but I still get this message:

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging.

I was hoping that slf4j would use the "configuration" of log4J 1.X, and that log4J 2.X would use the "configuration" of slf4j, so I would not need to do anything except configure log4J 1.X, but it does not seem to be the case.

Do I now have to duplicate my log4J 1.X configuration for log4J 2.X, or is there some easy work-around for this issue? Could it be some kind of "ordering" problem (what runs before what)?

1

1 Answers

1
votes

You need to exclude the dependencies to log4j2, the classes that your libraries depends on will be provided by log4j-to-slf4j.