How to enable HTTP logs in Android?

I wrote a simple application and I only get the logs I used. Log.i();
I want the main logs (for example, framework logs) to indicate how the httpclient, httpget, httppost, httprequest and httpresponse logs are sent and received.

Please let me know if there is any procedure.

+3
source share
2 answers
+4
source

For the 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
+3
source

Source: https://habr.com/ru/post/1790946/


All Articles