Enable Logging In Httpclientandroidlib
Solution 1:
Finally figured out the way to enable logging in httpclientandroidlib. Following APIs can enable different level of logging (mainly to html messages/headers that are being sent):
ManagedHttpClientConnectionFactory.INSTANCE.wirelog.enableDebug(true);
ManagedHttpClientConnectionFactory.INSTANCE.headerlog.enableDebug(true);
ManagedHttpClientConnectionFactory.INSTANCE.log.enableDebug(true);
Solution 2:
in any of the org.apache classes with statement
Log.isLoggable(TAG, Log.DEBUG);
like ./impl/conn/WireHC4.java
just hi-lite the code for the the suggestion:
"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."
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");
OR , without alter code, use the adb shell to set props above...
adb shell setprop log.tag.Wire VERBOSE
Post a Comment for "Enable Logging In Httpclientandroidlib"