Log4j2.0不适用于Jboss 5 [英] Log4j2.0 is not working with Jboss 5

查看:150
本文介绍了Log4j2.0不适用于Jboss 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在struts2和log4j2.0时遇到问题我的程序正常运行,但是log4j2.0没有响应,请帮助我解决问题.

i have issue with struts2 and log4j2.0 My program working properly but log4j2.0 is not respond pls help me to solve dis..

im使用以下jar: 1.log4j-core-2.0-beta8 2.log4j-api-2.0-beta8 3.log4j-web-2.0-beta2

im using following jar: 1.log4j-core-2.0-beta8 2.log4j-api-2.0-beta8 3.log4j-web-2.0-beta2

我的log4j2.xml

my log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration strict="true" schema="Log4J-V2.0.xsd" status="OFF" monitorInterval="300"> 

    <appenders>
        <Console name="CONSOLE" target="SYSTEM_OUT">
            <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n" />
        </Console>
        <File name="MyFile" fileName="Logger/knight.log">
            <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n" />
        </File>
    </appenders>
    <loggers>       
        <root>
            <appender-ref ref="CONSOLE" />
            <appender-ref ref="MyFile" />
        </root>
    </loggers>
</configuration>

我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
    <display-name>Struts2_Verified</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>

    </welcome-file-list>
     <context-param>  
       <param-name>log4jConfiguration</param-name>
       <param-value>log4j2.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.apache.logging.log4j.core.web.Log4jContextListener</listener-class>
    </listener>
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

推荐答案

我忘记了默认级别,但是首先尝试将其设置为冗长.

I forgot what the default level is, but try setting it as verbose as possible at first.

    <root level="TRACE">
        <appender-ref ref="CONSOLE" level="DEBUG" /> <!-- can have their own level -->
        <appender-ref ref="MyFile" />
    </root>

此外,要查看log4j2配置是否存在问题,请使用以下设置:

Also, to see if there is a problem with the log4j2 configuration, use this setting:

    <configuration status="TRACE" monitorInterval="300">

如果上述操作没有帮助,您可以在log4j-2问题跟踪器上为此筹集一张Jira票吗? ( https://issues.apache.org/jira/browse/LOG4J2 )log4j团队应该能够提供帮助.

If the above does not help, can you raise a Jira ticket for this on the log4j-2 issue tracker? (https://issues.apache.org/jira/browse/LOG4J2) The log4j team should be able to help out.

这篇关于Log4j2.0不适用于Jboss 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆