Mixing log4j 1.x and log4j 2

前端 未结 1 960
小蘑菇
小蘑菇 2020-12-14 16:46

I have a new application that is being written using log4j2, to take advantage of some of its new features. One of the libraries it uses is a bit older and was built with lo

相关标签:
1条回答
  • 2020-12-14 17:44

    Are you aware that log4j2 includes a bridge for log4j-1.2? You can use it by removing the old log4j-1.2.17.jar, and include these three jars:

    • log4j-api-2.x.jar
    • log4j-core-2.x.jar
    • log4j-1.2-api-2.x.jar

    This will result in all calls that your application makes to the log4-1.2 API to be routed to the log4j2 implementation. The FAQ has a diagram that may clarify things. (Don't forget to remove the old log4j-1.2 jar from the classpath!)

    0 讨论(0)
提交回复
热议问题