Log4j不会在JBoss 6 EAP下记录任何内容 [英] Log4j doesn't log anything under JBoss 6 EAP
问题描述
我在这个主题上看到了几个问题,但由于它们与错误相关,我认为这不是重复。
I saw several questions on the topic, but since they are rather related to errors I don't think this is a duplicate.
我的问题是我可以我没有登录。我正在部署在JBoss 6 EAP上的.war,但是也没有记录错误。还有一个名为mywar的文件在JBoss的/ log文件夹下创建,但它也是空的。
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.
.war部署正常并且有效。由于我使用Spring,我甚至看不到它初始化它的上下文。
The .war deploys fine and works. Since I'm using Spring I can't even see it initializing it's contexts.
在Tomcat 7下使用相同的.war进行日志记录完美。
Logging works perfectly under Tomcat 7 with the same .war.
我创建了一个log4j.xml并将其放在我的WEB-INF / classes目录中(我也在/ WEB-INF中试过):
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>
我正在使用log4j 1.2.17,Spring 3.1和JBoss 6 EAP。
I'm using log4j 1.2.17, Spring 3.1 and JBoss 6 EAP.
任何帮助非常感谢,
谢谢
Any help greatly appreciated, Thanks
推荐答案
与JBoss AS 7.1不同。 1,如果JBoss EAP 6找到日志配置文件,则会激活每个部署的日志记录配置: https://community.jboss.org/message/776182#776182
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
我建议删除 log4j.xml
。如果这没有用,请修改jboss配置以将系统属性 org.jboss.as.logging.per-deployment
设置为 false
。在我的情况下,我不得不将此行添加到 standalone.conf
:
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"
这篇关于Log4j不会在JBoss 6 EAP下记录任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!