开发者

How to enable the HTTP logs in Android?

开发者 https://www.devze.com 2023-02-09 05:53 出处:网络
I wrote a simple application and I am getting only those logs, I used Lo开发者_StackOverflowg.i();

I wrote a simple application and I am getting only those logs, I used Lo开发者_StackOverflowg.i();

I want the core logs (for example framework logs) how the httpclient, httpget, httppost, httprequest and httpresponse logs are sending and receiving data.

Please let me know if there is any procedure.


Here, try this: https://gist.github.com/cf23c4e184228a132390


For latest api, using this code

java.util.logging.Logger.getLogger("org.apache.http.wire").setLevel(java.util.logging.Level.FINEST);
java.util.logging.Logger.getLogger("org.apache.http.headers").setLevel(java.util.logging.Level.FINEST);

System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "debug");

and properties:

adb shell setprop log.tag.org.apache.http VERBOSE
adb shell setprop log.tag.org.apache.http.wire VERBOSE
adb shell setprop log.tag.org.apache.http.headers VERBOSE
0

精彩评论

暂无评论...
验证码 换一张
取 消