Sebastien Diot
Sebastien Diot

Reputation: 7359

Send Log4J 2.X events to Log4J 1.X

We have been using Log4J 1.2.X for ever. Recently, we updated some third-party libraries which moved to Log4J 2.X. Now, we get warnings at the start of our applications; something like "No log4j2 configuration file found. Using default configuration". We have a bunch of custom Log4J 1.X Appenders and Loggers. We have no intention of investing any time to upgrade those, along with literally millions of Java LOCs, to Log4J 2.X...

We could configure the Log4J 2.X to throw away all events, but it would be nicer if we could just pipe them into our Log4J 1.2.X configuration instead.

So, can we forward/bridge/adapt (with minimal work) Log4J 2.X events into Log4J 1.2.X?

Upvotes: 0

Views: 72

Answers (1)

kelgon
kelgon

Reputation: 401

You can adapt log4j 2.x to slf4j by using log4j-to-slf4j, and then bind slf4j to log4j 1.2.x by using slf4j-log4j12

By the way, I'm curious about which 3rd-party library require log4j2, shouldn't they rely on logging framework such as slf4j or commons-logging? Require a end-point logging library such as log4j or log4j2 is really quite dumb and unfriendly.

Upvotes: 1

Related Questions