In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the way Log4j closes Spring and Hibernate log printing". In daily operation, I believe that many people have doubts about what is the way Log4j closes Spring and Hibernate log printing. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "what is the way Log4j closes Spring and Hibernate log printing?" Next, please follow the editor to study!
Log4j turns off Spring and Hibernate log printing
The shutdown mentioned here does not mean that you do not print at all, you just need to change the log level.
In fact, we don't read ordinary info information, so just set it to warn or error level.
# close java-jdbc log outlog4j.logger.java.sql.Connection=ERRORlog4j.logger.java.sql.Statement=ERRORlog4j.logger.java.sql.PreparedStatement=ERROR#close spring log outlog4j.logger.org.springframework=WARN#close hibernate log outlog4j.logger.com.opensymphony.oscache=ERRORlog4j.logger.net.sf.navigator=ERRORlog4j.logger.net.sf.acegisecurity=WARNlog4j.logger.net.sf.acegisecurity.intercept.event.LoggerListener=WARNlog4j.logger.org.apache.commons=ERRORlog4j.logger.org.apache.struts=WARNlog4j.logger.org.displaytag=ERRORlog4j.logger.com.ibatis.db=WARNlog4j.logger.org. Apache.velocity=WARNlog4j.logger.com.canoo.webtest=WARNlog4j.logger.org.hibernate.ps.PreparedStatementCache=WARNlog4j.logger.org.hibernate=WARNlog4j.logger.org.hibernate.SQL=ERRORlog4j.logger.org.hibernate.type=ERRORLog4j closes Hibernate log output
Project reasons, when using Hibernate always output a large number of related logs, want to block out.
After various searches, I found the so-called methods on the Internet:
For example, set in the hibernate configuration file
False
Or set it in the log4j configuration file
# log4j for Hibernatelog4j.logger.org.hibernate=WARN
It didn't work.
My final solution here is to set the extra settings in the log4j configuration file.
# log4j for springMVClog4j.logger.org.springframework=WARN
It will take effect.
The reason is that the project I'm using uses spring for annotated configuration of hibernate.
The output of some related logs is based on the configuration of spring.
Therefore, the so-called hibernate-based configuration on the Internet is generally invalid.
At this point, the study on "what is the way Log4j closes Spring and Hibernate log printing" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.