Unable to exclude logmanager module on JBoss 6 EAP

2019-07-25 23:48发布

问题:

I'm trying to exclude all the logging modules from a jboss-deployment-structure.xml in JBoss 6 EAP.

My jboss-deployment-structure.xml is:

<jboss-deployment-structure>
  <deployment>
    <exclusions>
      <module name="org.apache.log4j" />
      <module name="org.jboss.logging" />
      <module name="org.jboss.logmanager" />
      <module name="org.jboss.log4j.logmanager" />
    </exclusions>
  </deployment>
</jboss-deployment-structure>

So after I deploy my .war with said configuration I get:

[ModuleClassLoader for Module "org.jboss.log4j.logmanager:main" from local module loader @10ab323 (roots: /home/me/dev/jboss-eap-6.0/modules)] whereas object of type "org.apache.log4j.ConsoleAppender" was loaded by [ModuleClassLoader for Module "deployment.myapp.war:main" from Service Module Loader].

So I generally want to make JBoss stop trying to load log4j and let my application load it.

Is it at all possible to disable the logmanager module ?

Thanks,

回答1:

I was able to resolve this problem using this jboss-deployment-structure.xml

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
    <exclusions>
        <module name="org.apache.log4j"/>
        <module name="org.apache.commons.logging"/>
    </exclusions>
</deployment>

Which I have created under WEB-INF. You should also put your log4j.jar in WEB-INF/lib.