如何关闭Spring 3调试日志记录? [英] How to turn off Spring 3 debug logging?

查看:94
本文介绍了如何关闭Spring 3调试日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想关闭Spring 3.1的log4j日志记录,同时让自己的代码处于调试状态.

I would like to turn off log4j logging for Spring 3.1 while leaving things on debug for my own code.

我尝试将这一行粘贴到我的log4j.properties中:

I tried sticking this line into my log4j.properties:

log4j.category.org.springframework = WARN 

要获取此信息:

# Root Logger Setup:  Includes the level of reporting and appenders -> where
#                     log messages get sent                                              
log4j.rootLogger                            = DEBUG,ca,fa

log4j.category.org.springframework = WARN

#ca - Console Appender - Send messages to the console
log4j.appender.ca                          = org.apache.log4j.ConsoleAppender
log4j.appender.ca.layout                   = org.apache.log4j.PatternLayout
log4j.appender.ca.layout.ConversionPattern = [acme]: [%-5p] - %d{yyyy-MMM-dd HH:mm:ss} -  %c{1}:%M(): %m%n



#fa - File Appender - Send messages to a log file
log4j.appender.fa                            = org.apache.log4j.RollingFileAppender
log4j.appender.fa.File                       = acme.log
log4j.appender.fa.MaxFileSize                = 100KB
log4j.appender.fa.MaxBackupIndex             = 10
log4j.appender.fa.Threshold                  = DEBUG
log4j.appender.fa.layout                     = org.apache.log4j.PatternLayout
log4j.appender.fa.layout.ConversionPattern   = [%-5p] - %d{yyyy-MMM-dd HH:mm:ss} -  %c{2}:%M(): %m%n 

不过,要关闭Spring的调试输出没有运气.

No luck in shutting off the debug output from Spring though.

在此先感谢您的帮助

史蒂夫

推荐答案

我知道了.

在我的类路径中,为方便起见,我有一个目录C:\ Classes.我在那里还有另一个log4.properties文件,该文件取代了我的WAR中打包的文件,使它看起来像下面的技术不起作用.我在C:\ Classes中重命名了log4.properties,一切都很好.

In my classpath I have a directory C:\Classes for convenience when I am experimenting with things. I had another log4.properties file there, which was superseding the one packaged in my WAR making it look like the technique below wasn't working. I renamed the log4.properties in my C:\Classes and all is well.

感谢大家的光临,并感谢Spring Source的人员,因为他们有此必要.很高兴知道,我愿意时可以轻松进行广泛的调试,而不仅仅是得到一个黑匣子.

Thanks to everyone who took a look and thanks to the people at Spring Source who made doing this necessary. It is good to know that an extensive level of debugging is easily available to me when I want it instead of just getting a black box.

这篇关于如何关闭Spring 3调试日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆