Create a file called "jboss-deployment-structure.xml" in the META-INF directory for an EAR or WEB-INF directory for a WAR. This file can contain a lot of different stuff to tweak the classloader, but for the logback case this is enough:
<?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure> <deployment> <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>
For the EAR case, you'll probably need to add a subdeployment for each application (both wars and ejbs) with the same exclusions. For more details, consult the JBoss documentation on the subject.
Thanks for making this post. Very useful.
ReplyDeleteHi, i managed to get logback work with my .war in wildfly 8, but when i try to log a message the message got logged something like this:
ReplyDelete16:53:30,272 INFO [stdout] (default task-2) 16:53:30.270 [default task-2] DEBUG b.c.a.c.c.r.MemberResourceRESTService - TESTE DE LOG PARAMETRO
As you can seei got date, log level and [stdout] it the start of my log message, how can i correct this?