Apache commons HTTPClient 和 log4j.xml
我将 Apache commons HTTPClient 与 Apache Axis 1.5 结合使用,并且尝试通过启用 org.apache.commons.httpclient 进行 DEBUG 并将 httpclient.wire 启用到 DEBUG 来记录进行 Web 服务调用时交换的消息。然而,这不起作用。下面提到的是我的 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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要将日志级别设置为 ALL,而不是 DEBUG
You need to have the log level set at ALL, not DEBUG
尝试将设置为
DEBUG
的priority
值放入 log4j.xml 中的
节点Try putting a
priority
value set toDEBUG
to your<root>
node in log4j.xml