How to enable logging for apache commons HttpClient on Android
Here is a solution (without digging into details)
Console:
adb shell setprop log.tag.httpclient.wire.header VERBOSE
adb shell setprop log.tag.httpclient.wire.content VERBOSE
Code:
java.util.logging.Logger.getLogger("httpclient.wire.header").setLevel(java.util.logging.Level.FINEST);
java.util.logging.Logger.getLogger("httpclient.wire.content").setLevel(java.util.logging.Level.FINEST);
Test:
java.util.logging.Logger.getLogger("httpclient.wire.content").log(java.util.logging.Level.CONFIG, "hola");
How to enable the HTTP logs in Android?
Here, try this:
https://gist.github.com/cf23c4e184228a132390
how to track http packets on android in java
If you're using Apache HttpClient you can turn on logging, see "How to enable logging for apache commons HttpClient on Android". The options for logging are very flexible.
But Google's energy is going into HttpURLConnection (see "Android Developer's Blog: Android's HTTP Clients"), perhaps somebody else can suggestion good ways to turn on logging there. There's one idea at "HTTP Get Using Android HttpURLConnection" though that particular example would disrupt your service.
Then there's always WireShark.
commons-logging defines classes that conflict with classes now provided by Android after Android Studio Update
Add to build.gradle
located in app module
configurations {
all {
exclude module: 'httpclient'
}
}
commons-validator and error commons-logging defines classes that conflict with classes now provided by Android
The problem is with commons-logging. So it must be excluded.
Add the following code in app/build.gradle. It should work.
configurations {
all {
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
}
Related Topics
Email Address Validation in Android on Edittext
Method Not Found Using Digestutils in Android
How to Make Alarm Manager Work When Android 6.0 in Doze Mode
Android Activity Ondestroy() Is Not Always Called and If Called Only Part of the Code Is Executed
What's the Difference Between Fill_Parent and Wrap_Content
How to Add a Line Break in an Android Textview
Exclude a Class from the Build in Android Studio
Turn on Location Services Without Navigating to Settings Page
Bind Service to Activity in Android
Google Cloud Endpoints and User's Authentication
Intent Action for Network Events in Android Sdk
Why Is Android Geocoder Throwing a "Service Not Available" Exception
What Is the Maximum Amount of Ram an App Can Use
Android Studio:How to Uninstall APK (Or Execute Adb Command) Automatically Before Run or Debug
How to Open a Different Activity on Recyclerview Item Onclick