使用spring时发现只能显示INFO LEVEL的log,classpath下的log4j.properties并没有起到作用。
Problem:JBOSS的自带了很多第三方jar包,deployment的时候,依赖首先从System Dependencies中查找,所以自带的有关logging的jar包就没有起作用,logging配置使用的是从jboss as继承而来的。
Solution: 在 WEB-INF下增加jboss-deployment-structure.xml。
<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure> <deployment> <exclusions> <module name="org.apache.commons.logging"/> <module name="org.slf4j"/> <module name="org.apache.log4j"/> </exclusions> </deployment> </jboss-deployment-structure>
详细资料见官方文档:https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7