How to prevent a module being implicitly loaded in JBoss EAP 6?
Environment
- JBoss Enterprise Application Platform 6.x
Issue
- Do not want to use JBoss default logging mechanism
- Use application's
log4j.xmlfor defining appender and log files. - How do I exclude dependencies in my deployment that are implicitly or automatically added by JBoss?
- How can I exclude a default module provided by JBoss so that the version packaged in my application can take precedence?
Resolution
Add jboss-deployment-structure.xml to WEB-INF with the desired module exclusions added like this:
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.logging"/>
</exclusions>
</deployment>
</jboss-deployment-structure>
The above will prevent the JBoss logging module to be loaded. For more details, see the relevant documenation section.
For instructions specific to Log4J, see How do I configure Log4J in EAP 6?.
Attached 1003552.zip is an example for preventing the use of the JBoss default log framework; it instead uses the application bundled Log4J.
Diagnostic Steps
- unzip 1003552.zip
- deploy 1003552/target/01003552.war to JBoss
- test via http://$IP:8080/log4jTest/Log4jTestServlet
- application log output to MyAppLogs.log
Attachments
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments