-
1. Re: Log4j2 configuration in JBoss EAP 7
andey Jun 22, 2017 8:10 AM (in response to anilteegala)1 of 1 people found this helpfulYou could add the following to your jboss-deployment-structure.xml (included in the war):
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<!--
Prevent that the server add automatically dependencies -->
<!-- Exclude all logging dependencies so we can use log4j2 -->
<exclusions>
<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" />
</exclusions>
</deployment>
</jboss-deployment-structure>
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.
-
2. Re: Log4j2 configuration in JBoss EAP 7
anilteegala Jun 22, 2017 4:12 PM (in response to andey)Thank you Anup. I will work on it and update on the same. As per our requirement we should use log4j2 with JBoss.
-
3. Re: Log4j2 configuration in JBoss EAP 7
jamezp Jul 1, 2017 3:29 PM (in response to andey)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