本文介绍了在httpclientandroidlib启用日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在我的Andr​​oid应用程序,并且无法登录调试日志从这个库。

I am using httpclientandroidlib in my android application and having trouble logging debug logs from this library.

我试过下面根据项目页面上的指令:

I had tried the following as per the instruction on the project page:

httpClient.log.enableDebug(true);

我也曾尝试提出解决方案here.

任何想法?

推荐答案

在任何org.apache类与语句

in any of the org.apache classes with statement

 Log.isLoggable(TAG, Log.DEBUG);

例如 ./ IMPL /康恩/ WireHC4.java

只是高亮度的code代表的建议:

just hi-lite the code for the the suggestion:

在你做你应该检查,看看你的代码应该记录到日志方法的任何调用,您可以通过设置系统属性更改默认的级别:'setprop log.tag去哪儿水平或者是冗长, 。DEBUG,INFO,WARN,ERROR,ASSERT,或SUP $ p $干燥综合征SUP preSS将关闭所有日志记录您的标记也可以创建一个local.prop文件在它下面的:日志。标记。=',并放置在/data/local.prop。

"Before you make any calls to a logging method you should check to see if your tag should be logged. You can change the default level by setting a system property: 'setprop log.tag. ' Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT, or SUPPRESS. SUPPRESS will turn off all logging for your tag. You can also create a local.prop file that with the following in it: 'log.tag.=' and place that in /data/local.prop."

这是说,所有的u需要做的就是WIRE&安培;在VERBOSE headers是包括在您的MainActivity.onCreate以下()

That said, all that u need to do to get WIRE & HEADERS at VERBOSE is to include the following in your MainActivity.onCreate()

//TEST ONLY
System.setProperty("log.tag.Headers", "VERBOSE");
System.setProperty("log.tag.Wire", "VERBOSE");

,或虽未ALTER code,使用adb shell设置上面...

OR , without alter code, use the adb shell to set props above...

adb shell setprop log.tag.Wire VERBOSE

这篇关于在httpclientandroidlib启用日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 20:37