Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable the HTTP logs in Android?

Tags:

android

I wrote a simple application and I am getting only those logs, I used Log.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.

like image 849
Suman Avatar asked Nov 19 '25 00:11

Suman


2 Answers

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

like image 194
Ollie C Avatar answered Nov 20 '25 15:11

Ollie C


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
like image 23
Bao Le Avatar answered Nov 20 '25 14:11

Bao Le



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!