Log4j关闭Spring和Hibernate日志打印

这里所说的关闭不是全部不打印,只需要修改一下log级别就好了。
普通的info信息其实我们是不看的,所以直接设置成warn或error级别就好了。

#close java-jdbc log out
log4j.logger.java.sql.Connection=ERROR
log4j.logger.java.sql.Statement=ERROR
log4j.logger.java.sql.PreparedStatement=ERROR

#close spring log out
log4j.logger.org.springframework=WARN

#close hibernate log out
log4j.logger.com.opensymphony.oscache=ERROR
log4j.logger.net.sf.navigator=ERROR
log4j.logger.net.sf.acegisecurity=WARN
log4j.logger.net.sf.acegisecurity.intercept.event.LoggerListener=WARN
log4j.logger.org.apache.commons=ERROR
log4j.logger.org.apache.struts=WARN
log4j.logger.org.displaytag=ERROR
log4j.logger.com.ibatis.db=WARN
log4j.logger.org.apache.velocity=WARN
log4j.logger.com.canoo.webtest=WARN
log4j.logger.org.hibernate.ps.PreparedStatementCache=WARN
log4j.logger.org.hibernate=WARN
log4j.logger.org.hibernate.SQL=ERROR
log4j.logger.org.hibernate.type=ERROR

你可能感兴趣的:(JavaEE,log4j,java,spring,hibernate)