如何不在控制台,显示这些DEBUG信息
我的Struts项目,在控制台打印了很多信息。我想把它关掉
2013-05-08 16:38:17.697::INFO: Logging to STDERR via org.mortbay.log.StdErrLog [INFO] Context path = / [INFO] Tmp directory = determined at runtime [INFO] Web defaults = D:javaprojectfinancewebdefault.xml [INFO] Web overrides = none [INFO] Webapp directory = D:javaprojectfinancesrcmainwebapp 2013-05-08 16:38:17.768::INFO: jetty-6.1.10 [INFO] Starting jetty 6.1.10 ... 2013-05-08 16:26:19.018::INFO: No Transaction manager found - if your webapp requires one, please configure one. 2013-05-08 16:26:20.320:/:INFO: Initializing Spring root WebApplicationContext 16:26:20.283 [main] INFO o.s.web.context.ContextLoader - Root WebApplicationContext: initialization started 16:26:20.316 [main] INFO o.s.w.c.s.XmlWebApplicationContext - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1bf9b45: display name [Root WebApplicationContext]; startup date [Wed May 08 16:26:20 CST 2013]; root of context hierarchy 16:26:20.348 [main] DEBUG o.s.c.i.s.PathMatchingResourcePatternResolver - Looking for matching resources in directory tree [D:javaprojectfinancetargetclasses] 16:26:20.348 [main] DEBUG o.s.c.i.s.PathMatchingResourcePatternResolver - Searching directory [D:javaprojectfinancetargetclasses] for files matching pattern [D:/java/project/finance/target/classes/applicationContext-*.xml] 16:26:20.349 [main] DEBUG o.s.c.i.s.PathMatchingResourcePatternResolver - Resolved location pattern [classpath:applicationContext-*.xml] to resources [file [D:javaprojectfinancetargetclassesapplicationContext-base.xml], file [D:javaprojectfinancetargetclassesapplicationContext-bean.xml]] 16:26:20.349 [main] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [D:javaprojectfinancetargetclassesapplicationContext-base.xml] 16:26:20.352 [main] DEBUG o.s.b.f.xml.DefaultDocumentLoader - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl] 16:26:20.378 [main] DEBUG o.s.b.f.xml.PluggableSchemaResolver - Loading schema mappings from [META-INF/spring.schemas] 16:26:20.379 [main] DEBUG o.s.b.f.xml.PluggableSchemaResolver - Loaded schema mappings: {http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/jms/spring-jms-2.5.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/jms/spring-jms.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang- 16:38:32.348 [btpool0-3] DEBUG o.s.jdbc.core.JdbcTemplate - Executing SQL query [SELECT u.email,u.userId,u.inport,((select count(*) from user_pay_plan_h ta where ta.userId=u.userId and orderId<>0 and createDate < '2013-05-08 16:17:11')+(select count(*) from user_pay_apple_h tb where tb.userId=u.userId and purchase_date < '2013-05-08 16:17:11')+(select count(*) FROM coupon c left join reward r on c.rewardId=r.id left join coupon_give g on c.keyNo=g.keyNo where g.useUserId=u.userId and c.cardNo like 'P%' and c.useTime < '2013-05-08 16:17:11')+(select count(*) FROM coupon c left join reward r on c.rewardId=r.id left join coupon_edit_history h on c.editId=h.id where c.userId=u.userId and c.useTime < '2013-05-08 16:17:11' and c.type=1 and c.cardNo not like '99%' and c.cardNo not like 'Z%' and c.cardNo not like 'F%' and c.cardNo not like 'P%' and h.money>0)+1) as count from user u where u.userId =338841] 16:38:32.348 [btpool0-3] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
我在WEB.XML里面配置了log4j的信息
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/log4j.properties</param-value> </context-param> <!-- 每隔60秒检测一下Lo4j配置文件 --> <context-param> <param-name>log4jRefreshInterval</param-name> <param-value>60000</param-value> </context-param>
也在WEB-INF下面,添加了log4j.properties文件
文件内容如下
log4j.rootLogger = WARN, D, E log4j.logger.com.opensymphony.xwork2= WARN log4j.logger.java.sql.Connection=DEBUG log4j.logger.java.sql.Statement=DEBUG log4j.logger.java.sql.PreparedStatement=DEBUG log4j.logger.java.sql.ResultSet=DEBUG log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n log4j.appender.logfile=org.apache.log4j.RollingFileAppender log4j.appender.logfile.File=d:/itSupport.log log4j.appender.logfile.MaxFileSize=512KB # Keep three backup files. log4j.appender.logfile.MaxBackupIndex=3 # Pattern to output: date priority [category] - message log4j.appender.logfile.layout=org.apache.log4j.PatternLayout log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] - %m%n
请问,我的设置有什么问题,我如何才能不显示这些垃圾信息
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
LZ好好研究下log4j吧;还有你的web服务器跟hibernate、spring(如果用到了)也会有日志输出;单纯从你个人建的日志配置文件配置一些东西是无法完全控制你的控制台输出信息的
试了,没用,可能是其它地方的问题
把
log4j.properties中
DEBUG都改成WARN甚至更高级别