配置log4j axis1找不到记录器的appender

时间:2012-10-22 20:36:27

标签: log4j axis

我尝试使用axis1部署Web服务,并在我的Web服务类log4j logger中用作

private static final Logger logger = Logger.getLogger(MobileService.class
            .getName());

logger.debug("Count nodes" + nodes.getLength());

我的班级有默认包。我使用下一个log4j.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

    <appender name="HTML-APPENDER" class="org.apache.log4j.DailyRollingFileAppender">
        <param name="File" value="${catalina.home}/webapps/axis/WEB-INF/classes/log.html" />
        <param name="DatePattern" value="'.'yyyy-MM-dd-HH'.html'" />
        <layout class="org.apache.log4j.HTMLLayout" />
        <filter class="org.apache.log4j.varia.LevelRangeFilter">
            <param name="LevelMin" value="ALL"/>
            <param name="LevelMax" value="INFO"/>
        </filter>
    </appender>

</log4j:configuration>

我还在类路径中添加了下一步部署我的应用程序

set CATALINA_HOME=C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0
set PATH_TO_LOG4J=C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\axis\WEB-INF\classes\log4j.xml
java -Dlog4j.info -Dlog4j.configuration="file:C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\axis\WEB-INF\classes\log4j.xml" -cp "%CATALINA_HOME%\webapps\axis\WEB-INF\lib\axis.jar;%CATALINA_HOME%\webapps\axis\WEB-INF\lib\jaxrpc.jar;%CATALINA_HOME%\webapps\axis\WEB-INF\lib\commons-logging-1.0.4.jar;%CATALINA_HOME%\webapps\axis\WEB-INF\lib\wsdl4j-1.5.1.jar;%CATALINA_HOME%\webapps\axis\WEB-INF\lib\commons-discovery-0.2.jar;%CATALINA_HOME%\webapps\axis\WEB-INF\lib\saaj.jar;%CATALINA_HOME%\common\lib\activation.jar;%CATALINA_HOME%\common\lib\mail.jar;%CATALINA_HOME%\webapps\axis\log4j-1.2.8.jar" org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService MobileService.wsdd
pause

但即便-Dlog4j.info -Dlog4j.configuration=也无济于事。我收到错误no appenders could be found for logger (org.apache.axis.i18n.projectresourcebundle)

你能帮助我吗?

1 个答案:

答案 0 :(得分:2)

我想,您忘记配置记录器了。例如,要配置根记录器,请将以下行放在log4j.xml文件的末尾(</log4j:configuration>之前):

<root> 
    <priority value ="debug" /> 
    <appender-ref ref="HTML-APPENDER" /> 
</root>