Apache commons HTTPClient and log4j.xml

java_pill picture java_pill · Mar 24, 2010 · Viewed 9.9k times · Source

I'm using Apache commons HTTPClient with Apache Axis 1.5 and I'm trying to log the messages exchanged when making Web Service calls by enabling org.apache.commons.httpclient to DEBUG and httpclient.wire to DEBUG. However, this doesn't work. Mentioned below is my log4j.xml - can someone help me? Thanks

<?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>

Answer

puug picture puug · Jun 3, 2010

You need to have the log level set at ALL, not DEBUG

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