Log4j doesn't log anything under JBoss 6 EAP
Asked Answered
T

2

9

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

Tabbie answered 1/10, 2012 at 9:12 Comment(1)
Related: #8814998 and https://mcmap.net/q/1171180/-use-my-log4j-under-jboss-6Nijinsky
A
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"
Avert answered 29/1, 2013 at 4:48 Comment(6)
It switches off configuration which is defined in application, so it's a workaround but not a solution, right?Hypnotherapy
worked for me! JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.as.logging.per-deployment=false"Jewett
if you remove log4j.xml where do you get you own configuration from ?Claro
@Claro the configuration lives in the logging section of EAP's standalone.xml, so you would need to customise the log configuration there.Avert
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.Claro
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. ThanksModule
C
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.

Cancel answered 25/2, 2015 at 1:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.