8

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

seanf
  • 6,504
  • 3
  • 42
  • 52
Simeon
  • 7,582
  • 15
  • 64
  • 101
  • 2
    Related: http://stackoverflow.com/questions/8814498/log4j-logger-messages-are-not-displayed-on-jboss-webapp and http://stackoverflow.com/questions/12039763/use-my-log4j-under-jboss-6 – Vadzim Oct 18 '12 at 14:29

2 Answers2

20

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"
seanf
  • 6,504
  • 3
  • 42
  • 52
  • It switches off configuration which is defined in application, so it's a workaround but not a solution, right? – Vadim Kirilchuk Nov 26 '13 at 22:14
  • worked for me! JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.as.logging.per-deployment=false" – Rodrigo Tavares Feb 25 '15 at 02:10
  • if you remove log4j.xml where do you get you own configuration from ? – Tom Jan 24 '17 at 08:17
  • @Tom the configuration lives in the logging section of EAP's `standalone.xml`, so you would need to customise the log configuration there. – seanf Jan 24 '17 at 12:57
  • I have managed to use a log4j2.xml config file. Now it works fine, I had to put the file into subProject/properties/... This way I have the regular server logging and my specific app logging in a separate file. – Tom Feb 06 '17 at 08:40
  • I had the same problem with the supposed logging produced by Liferay 6.2, and when I put the property on JBoss immediately the log appears. Thanks – pazfernando Sep 22 '17 at 14:18
3

In my case, EAP 6.0 in domain mode, I had to set org.jboss.as.logging.per-deployment = false as an environment property for the specific server. Setting it as a "System Property" as stated in the EAP 6.3 docs did not work.

DAC
  • 707
  • 1
  • 6
  • 20