Apache公共HTTPClient和log4j.xml

时间:2010-03-24 17:56:08

标签: log4j apache-commons-httpclient

我正在使用Apache commons HTTPClient和Apache Axis 1.5,我正在尝试通过启用org.apache.commons.httpclient到DEBUG和httpclient.wire到DEBUG来记录进行Web Service调用时交换的消息。但是,这不起作用。下面提到的是我的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="rolling" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="File" value="test.log" />
<layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d [%t] %-5p %c:%L - %m%n"/>
</layout>
</appender>
<logger name="org.apache.commons.httpclient">
    <level value="DEBUG"/>
</logger>
<logger name="httpclient.wire">
<level value="DEBUG"/>
</logger>
<root>
<level value="DEBUG" />
<appender-ref ref="rolling"/>
</root>


</log4j:configuration>

2 个答案:

答案 0 :(得分:3)

您需要将日志级别设置为ALL,而不是DEBUG

<logger name="httpclient.wire">
    <level value="ALL"/>
</logger>

答案 1 :(得分:0)

尝试将设置为priority的{​​{1}}值放入log4j.xml中的DEBUG节点

<root>