Log4j doesn't log anything under JBoss 6 EAP

Simeon picture Simeon · Oct 1, 2012 · Viewed 24.4k times · Source

I saw several questions on the topic, but since they are rather related to errors I don't think this is a duplicate.

My problem is that I can't get any logging out of a .war I'm deploying on JBoss 6 EAP, there are no errors logged also however. There is also a file named as my .war created under the /log folder in JBoss, but it is also empty.

The .war deploys fine and works. Since I'm using Spring I can't even see it initializing it's contexts.

Logging works perfectly under Tomcat 7 with the same .war.

I have created a log4j.xml and placed it in my WEB-INF/classes dir (I also tried in /WEB-INF):

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="console" class="org.apache.log4j.ConsoleAppender"> 
    <param name="Target" value="System.out"/> 
    <layout class="org.apache.log4j.PatternLayout"> 
      <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/> 
    </layout> 
  </appender> 

  <root> 
    <priority value ="info" /> 
    <appender-ref ref="console" /> 
  </root>

</log4j:configuration>

I'm using log4j 1.2.17, Spring 3.1 and JBoss 6 EAP.

Any help greatly appreciated, Thanks

Answer

seanf picture seanf · Jan 29, 2013

Unlike JBoss AS 7.1.1, JBoss EAP 6 activates per-deployment logging configuration if it finds a logging config file: https://community.jboss.org/message/776182#776182

I suggest removing log4j.xml. If that doesn't help, modify your jboss configuration to set the system property org.jboss.as.logging.per-deployment to false. In my case, I had to add this line to standalone.conf:

JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.as.logging.per-deployment=false"