# How can I enable httpclient logging in ODK?

**URL:** <https://forum.getodk.org/t/how-can-i-enable-httpclient-logging-in-odk/2073>\
**Category:** Support\
**Created:** [March 28, 2013, 12:01pm UTC](https://forum.getodk.org/t/how-can-i-enable-httpclient-logging-in-odk/2073 "2013-03-28T12:01:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shruthd](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/s/ee7513/32.png) [@Shruthd](https://forum.getodk.org/u/Shruthd)\
**Post date:** [March 28, 2013, 12:01pm UTC](https://forum.getodk.org/t/how-can-i-enable-httpclient-logging-in-odk/2073/1 "2013-03-28T12:01:38Z")

</div>

Hi,

We have a strange issue where the upload of data is failing when on data plan but works fine on wifi. This issue happens only in Swaziland and no where else.

Issue,

Even though HttpClient is configured with setAuthenticating as 'True', the client is not responding to 401 challenges for POST requests. But the same works fine for HEAD requests.

Attaching the request logs for both the scenarios.

Help,

We wanted to add some additional logging on the ODK side to log all the requests and responses.

Tried to follow this, but couldn't get it to work:  
[http://stackoverflow.com/questions/3246792/how-to-enable-logging-for-apache-commons-httpclient-on-android/3303131#3303131](http://stackoverflow.com/questions/3246792/how-to-enable-logging-for-apache-commons-httpclient-on-android/3303131#3303131)

Any help will be appreciated!

-Shruthi

[logs.txt](https://getodk.b-cdn.net/uploads/default/original/1X/88f0f3ed510f746785fb2a3bd843580f7b09a0f5.txt) (3.17 KB)

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [March 28, 2013, 5:30pm UTC](https://forum.getodk.org/t/how-can-i-enable-httpclient-logging-in-odk/2073/2 "2013-03-28T17:30:16Z")

</div>

What Android OS are you using?

Is this using both ODK Collect and ODK Aggregate? What versions of each?

In the success case, your phone should only be issuing at most 2 HEAD  
requests,

HEAD -- no authentication -- returns 401

HEAD -- with authentication -- returns 204

then, a single POST with authentication, returning 201

It looks like there are two simultaneous attempts to send data to the  
server running at the same time. This may be the root cause of  
[http://code.google.com/p/opendatakit/issues/detail?id=692](http://code.google.com/p/opendatakit/issues/detail?id=692)

Mitch

> **···**
>
> On Thu, Mar 28, 2013 at 5:01 AM, wrote:
> 
> > Hi,
> > 
> > We have a strange issue where the upload of data is failing when on data  
> > plan but works fine on wifi. This issue happens only in Swaziland and no  
> > where else.
> > 
> > Issue,
> > 
> > Even though HttpClient is configured with setAuthenticating as 'True', the  
> > client is not responding to 401 challenges for POST requests. But the same  
> > works fine for HEAD requests.
> > 
> > Attaching the request logs for both the scenarios.
> > 
> > Help,
> > 
> > We wanted to add some additional logging on the ODK side to log all the  
> > requests and responses.
> > 
> > Tried to follow this, but couldn't get it to work:
> > 
> > [http://stackoverflow.com/questions/3246792/how-to-enable-logging-for-apache-commons-httpclient-on-android/3303131#3303131](http://stackoverflow.com/questions/3246792/how-to-enable-logging-for-apache-commons-httpclient-on-android/3303131#3303131)
> > 
> > Any help will be appreciated!
> > 
> > -Shruthi
> > 
> > ## --
> > 
> > Post: [opendatakit@googlegroups.com](mailto:opendatakit@googlegroups.com)  
> > Unsubscribe: [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com)  
> > Options: [http://groups.google.com/group/opendatakit?hl=en](http://groups.google.com/group/opendatakit?hl=en)
> > 
> > * * *
> > 
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Community" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit+unsubscribe@googlegroups.com](mailto:opendatakit+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)
