Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problems encountered in log4j upgrading log4j2

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to solve the problems encountered in log4j upgrade log4j2. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

Log4j upgrade log4j2 problem 1. Import package org.slf4j slf4j-api ${slf4j.version} org.slf4j jcl-over-slf4j ${slf4j.version} org.apache.logging.log4j log4j-core 2.8.2 org.apache.logging.log4j log4j-slf4j-impl 2.8.2

Note: some packages may rely on log4j, but only log4j2 will be left after the upgrade, and an error will be reported that the class cannot be found, such as:

Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger

So if these packages do not use the slf4 interface, but must rely on log4j, if you really do not want to import the log4j package, you can only find a toolkit that can replace this package.

Such as:

Com.github.sgroschupf zkclient 0.1 log4j log4j

Replace it with the following package, which is fine:

Com.101tec zkclient 0.10 log4j log4j slf4j-log4j12 org.slf4j II. Create a new log4j2.xml file under src/main/resources

The configuration is as follows

1.7.132.33.3.23.2.4.RELEASE org.apache.logging.log4j log4j-api ${log4j2.version} org.apache.logging.log4j log4j-core ${log4j2.version} com.lmax disruptor ${disruptor.version} org.slf4j slf4j-api ${slf4j.version} org.apache.logging.log4j log4j-slf4j-impl ${log4j2.version} org encountered in upgrading log4j2 This is the end of the article .springframework spring-core commons-logging commons-logging org.slf4j jcl-over-slf4j ${slf4j.version} runtime org.slf4j log4j-over-slf4j ${slf4j.version} on "how to solve the problems encountered in log4j upgrade log4j2". Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report