Use my own log4j.xml with EAP 6.1
Seems that this question is everywhere, but I've yet to come up with a solution. I have a WEB-INF\classes\log4j.xml with the root level of the logger set to DEBUG.
I'm deploying the following in my WEB-INF\lib directory
log4j-1.2.17.jar
slf4j-api-1.7.5.jar
slf4j-log4j12-1.7.5.jar
I have a jboss-deployment-structure.xml file at the root of WEB-INF\ that looks like this.
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.apache.log4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Then in my run.conf there was already a line for
JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.as.logging.per-deployment=false"
and I've confirmed this is getting used from the console.log.
When JBOSS starts up all I get is INFO messages and it doesn't appear to be using my log4j.xml configuration whatsoever.
What are the steps needed to use my log4j.xml and my deployed jars for logging?
Responses
Hi,
The document you referenced should be working for you. Can I suggest that you raise a support case and attach your war so that we can have a closer look?
One note though, with this property, -Dorg.jboss.as.logging.per-deployment=false, JBoss won't automatically search your deployment for a config file. You must configure the logger in your code and use your config file.
Regards
Dave
Yes, the jboss-deployment-structure.xml goes in the WEB-INF directory[1].
You would need both module exclusions if you wanted to exclude the jars supplied by the application server and use those you have packaged.
[1] https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html-single/Development_Guide/index.html#Add_an_Explicit_Module_Dependency_to_a_Deployment1
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
