我有一个耳朵,有战争作为子部署。 ear文件有一个META-INF目录,它有一个只有ejb-recievers元素和webscheduler.war的jboss-ejb-client.xml文件。这场战争使用了commons-logging-api.jar。这个应用程序部署在jboss 7.1.1.final。我想使用apache log4j进行日志记录。所以,我在耳边jboss as 7.1.1最终日志记录
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.apache.log4j" />
<module name="org.log4j"/>
<module name="org.jboss.logging"/>
</exclusions>
</deployment>
<sub-deployment name="a.war">
<exclusions>
<module name="org.apache.log4j"/>
<module name="org.log4j"/>
<module name="org.jboss.logging"/>
</exclusions>
</sub-deployment>
</jboss-deployment-structure>
我对战争的lib目录中有以下内容的commons-logging.properties文件的META-INF目录添加一个JBoss部署,structure.xml,
org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl
log4j.configuration =的/ usr /共享/第w/JBoss的/ JBoss的-AS-7.1.1 /独立/配置/的log4j.xml
而且除了一个的log4j-1.2.11.jar我在lib中没有任何其他日志框架jar(比如SLF4j等)。如您所见,log4j.xml位于上述属性所描述的目录中。
问题是当我启动jboss时,一些应用程序日志确实被写入log4j.xml中描述的日志文件(比如/a/b/c/srv.log),但同时日志也被写入jboss日志中的默认srv.log(jboss/standalone/log/srv.log)。
我缺少什么jboss不使用自己的日志记录并使用我提供的log4j配置。
希望这将有助于http://stackoverflow.com/questions/14182257/using-applications-log4j-configuration-under-jboss-7-1-1/14337990#14337990 – gYanI 2013-03-07 06:37:49