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

Slf4j+log4j upgrade log4j2

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

First add the following dependencies to the pom file

Org.apache.logging.log4j log4j-api 2.6.2 org.apache.logging.log4j log4j-core 2.6.2 org.apache.logging.log4j log4j-web 2.6.2 org.slf4j slf4j-api 1.7.12 org.slf4j jcl-over-slf4j 1.7.12 org.apache.logging.log4j log4j-slf4j-impl 2.6.2

Delete the original slf4j dependency

Org.slf4j slf4j-log4j12 1.7.7

Rewrite log4j.xml configuration file

The original log4j in the project prints logs on an hourly basis, so RollingRandomAccessFile is used.

Then, rename log4j.xml to log4j2.xml, and cancel the original context configuration in web.xml!

Because the above 1.1 did not do at the beginning, but only modified the content on the basis of the original log4j.xml, so when it was packaged and run on the server, there was no log file output, because other projects relied on in the pom file had log4j-related jar packages, and slf4j did not know which one to use.

Upgrade complete.

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

Internet Technology

Wechat

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

12
Report