以下是我的Tomcat 7控制台上发布的一些日志记录语句示例。大多数是来自开放的saml或hibernate,我试图阻止它们出来。我正在使用logback并将根记录器和所有其他记录器置于WARN或更高版本,我无法弄清楚为什么某些库继续注销INFO和DEBUG级别语句。有什么想法吗?
14:40:45.360 [localhost-startStop-6] DEBUG org.opensaml.xml.XMLConfigurator - {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Username intialized and configuration cached
14:40:45.360 [localhost-startStop-6] DEBUG org.opensaml.xml.XMLConfigurator - Initializing object provider {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken
14:40:45.360 [localhost-startStop-6] DEBUG org.opensaml.xml.Configuration - Registering new builder, marshaller, and unmarshaller for {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken
14:40:45.361 [localhost-startStop-6] DEBUG org.opensaml.xml.XMLConfigurator - {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}UsernameToken intialized and configuration cached
14:40:45.361 [localhost-startStop-6] DEBUG org.opensaml.xml.XMLConfigurator - ObjectProviders load complete14:40:45.361 [localhost-startStop-6] DEBUG org.opensaml.xml.XMLConfigurator - Preparing to load IDAttributes
14:40:45.361 [localhost-startStop-6] DEBUG org.opensaml.xml.XMLConfigurator - IDAttribute {http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Id has been registered
14:40:45.361 [localhost-startStop-6] DEBUG org.opensaml.xml.XMLConfigurator - IDAttributes load complete
14:40:45.361 [localhost-startStop-6] DEBUG org.opensaml.DefaultBootstrap - Initializing SAML Artifact builder factories
答案 0 :(得分:2)
在寻找解决方案几个月之后,我偶然发现了这个网站上的相关答案:
logbback generating too many logs on Tomcat console at startup
答案 1 :(得分:0)
尽管有上述有用的超链接和引用,我也花了很多时间来弄明白。我的配置是从Spring Tools Suite启动的TcServer中运行的Tomcat 7实例。 但是,给出了线索:logback确实(仍然)是罪魁祸首,尽管我已经从我的maven依赖层次结构中完全删除了它,转而支持slf4j下的纯log4j绑定(当然没有LogbackConfigListener留在我能想到的其他地方)......但是我忘了强制maven清理,并且在构建war存档的目标子目录中仍然存在logback jar的副本。令人遗憾的是,战争中这个回归jar的存在足以欺骗服务器登录到DEBUG模式。项目清理 - maven clean - rebuild,maven包再次部署:服务器日志现在在控制台上清理,最后符合我的src / main / resources / log4j.xml配置,虽然我没有更改单个日志配置文件。
额外提示以节省额外时间:严格依赖slf4j-log4j重新依赖,确保使用JRE1.6或更高版本与log4j版本1.2.17而不是1.2.15以避免另外一串关于丢失maven依赖关系的问题。 ,jdmk和jmx ......: - )
提醒:自定义从STS启动的TcServer / tomcat的日志配置:http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2009731