Apache commons HTTPClient and log4j.xml
-
22-09-2019 - |
Question
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>
Solution
You need to have the log level set at ALL, not DEBUG
<logger name="httpclient.wire">
<level value="ALL"/>
</logger>
OTHER TIPS
Try putting a priority
value set to DEBUG
to your <root>
node in log4j.xml
<root>
<level value="DEBUG" />
<priority value="DEBUG" />
<appender-ref ref="rolling"/>
</root>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow