我把log4j的输出级别设置到DEBUG,发现打印的信息太多,如何解决

04-08 15:46:48[DEBUG]Closing expired connections

04-08 15:46:48[DEBUG]Closing connections idle longer than 60000 MILLISECONDS

04-08 15:46:52[DEBUG]getResource()=file:/D:/SaaS/myjfinal/target/classes/

04-08 15:46:53[DEBUG]batch acquisition of 0 triggers

04-08 15:46:53[DEBUG]Closing expired connections

04-08 15:46:53[DEBUG]Closing connections idle longer than 60000 MILLISECONDS

04-08 15:46:57[DEBUG]getResource()=file:/D:/SaaS/myjfinal/target/classes/

04-08 15:46:58[DEBUG]Closing expired connections

04-08 15:46:58[DEBUG]Closing connections idle longer than 60000 MILLISECONDS

如题,不断的打印如上的信息,如何关闭,谢谢。

还有大量如下的信息:

04-08 15:45:48[DEBUG]loaded class com.jfinal.template.expr.ast.Compare from WebAppClassLoader=33524623@1ff8b8f

04-08 15:45:48[DEBUG]loaded class com.jfinal.template.expr.ast.Arith from WebAppClassLoader=33524623@1ff8b8f

04-08 15:45:48[DEBUG]loaded class com.jfinal.template.expr.ast.NullSafe from WebAppClassLoader=33524623@1ff8b8f

04-08 15:45:48[DEBUG]loaded class com.jfinal.template.expr.ast.IncDec from WebAppClassLoader=33524623@1ff8b8f

04-08 15:45:48[DEBUG]loaded class com.jfinal.template.expr.ast.StaticMethod from WebAppClassLoader=33524623@1ff8b8f

04-08 15:45:48[DEBUG]loaded class com.jfinal.template.expr.ast.StaticField from WebAppClassLoader=33524623@1ff8b8f


评论区

JFinal

2018-04-08 16:54

配置为 warn 或者 error 级别

如果仍然希望配置为 debug 级别,但不希望输出太多信息,可以让针对不同的类、不同的 packag 来设置更高的级别,类似于:
log4j.logger.org.hibernate.SQL=WARN
log4j.logger.org.apache=WARN
log4j.logger.org.apache.catalina=ERROR
log4j.logger.org.apache.commons=WARN

注意上面的 log4j.logger 这个前缀与你前面的配置有关,而这个前缀后面的下面这些东东才是真正被控制的 package 与 class
org.hibernate.SQL=WARN
org.apache=WARN
org.apache.catalina=ERROR
org.apache.commons=WARN

rirai

2018-04-08 20:01

@JFinal 谢谢大神

热门反馈

扫码入社