1 of 1 people found this helpful
You could add the following to your jboss-deployment-structure.xml (included in the war):
<?xml version="1.0" encoding="UTF-8"?>
Prevent that the server add automatically dependencies -->
<!-- Exclude all logging dependencies so we can use log4j2 -->
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j" />
<module name="org.jboss.logging" />
<module name="org.jboss.logging.jul-to-slf4j-stub" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.logmanager.log4j" />
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
Then you could include the log4j2 jar in your application and put the log4j2 config file in a file system folder if you add an apprpriate module definition.
This all depends though on the logging api that your application is using - e.g. against which api it is compiled. If you can change it I'd suggest to use slf4j that would be the most flexible solution.
Thank you Anup. I will work on it and update on the same. As per our requirement we should use log4j2 with JBoss.
Instead of excluding each module you could just exclude the logging subsystem which would stop all the logging dependencies from being added to your deployment.
<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure> <deployment> <exclude-subsystems> <subsystem name="logging"/> </exclude-subsystems> </deployment> </jboss-deployment-structure>
James R. Perkins