title: Application using jboss-logging when it should use log4j
body: <p>I'm upgrading a Spring MVC application from Spring 3.1 to 4.3, and Hibernate 3.6 to 5.2. I'll be running this in Wildfly 8. Dependencies are managed by Maven.</p>
  
  <p>Spring uses commons-logging, which looks at the classpath of the application and attempts to choose a suitable logging framework. In my case, it seems to be choosing the wrong one. I have included log4j in my pom.xml, and checking the dependency hierarchy I can see that jboss-logging is not there. Here is the error message I'm getting:</p>
  
  <pre><code>Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf
  </code></pre>
  
  <p>So even though I don't have jboss logging in my project, commons-logging is finding it somewhere and attempting to use it, but unsuccessfully. After some searching I found jboss-logging-3.1.4.GA.jar in Wildfly.</p>
  
  <p>The reason for the error is that this is an old version of jboss-logging. I added a newer jar to the server and edited module.xml to point to it, and the error went away. That proves that commons-logging is finding jboss-logging on the server.</p>
  
  <p>The problem is that I don't want jboss-logging, I want log4j. How do I force commons-logging to use log4j and ignore what is on the server?</p>
  
  <p><strong>Edit:</strong> I followed the link chrisharm put up and added these lines to the standalone.xml file :</p>
  
  <pre><code>&lt;add-logging-api-dependencies value="false"/&gt;
  &lt;use-deployment-logging-config value="false"/&gt;
  </code></pre>
  
  <p>I also changed the module.xml to point to the older jar again, since I would rather see an error if jboss is used. When I run now I get this: </p>
  
  <pre><code>Caused by: java.lang.NoClassDefFoundError: org/jboss/logging/Logger
  </code></pre>
  
  <p>This may be a step in the right direction, since now Spring doesn't have access to jboss-logging, but it is still trying to use it for some reason.</p>