Troubleshooting

If you're having trouble with Java try turning on debug logging. It is often difficult to filter through the exception stack traces and interpret the error messages. So getting the exact response message from the server can often save time.

Debugging

First, add a logging.properties file to the root of your project, adjacent to the src directory.

Copy and paste the following into that file:

# Properties file which configures the operation of the JDK logging facility.
# The system will look for this config file to be specified as a system property:
# -Djava.util.logging.config.file=${project_loc}/logging.properties

# Set up the console handler (uncomment "level" to show more fine-grained messages)
handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = CONFIG

# Set up logging of HTTP requests and responses (uncomment "level" to show)
com.google.api.client.http.level = CONFIG

Then, set the following system property when running your application:

-Djava.util.logging.config.file=${project_loc}/logging.properties

You will see detailed information in the console including HTTP headers and request bodies.

CONFIG: -------------- REQUEST  --------------
GET https://baas.kinvey.com/appdata/kid_ePZ9kJuZMi/native/5268356186291fe62c001872
Accept-Encoding: gzip
Authorization: <Not Logged>
User-Agent: android-kinvey-http/2.6.8
x-kinvey-api-version: 3
x-kinvey-device-information: JAVA/1.6.0_51

Oct 23, 2013 4:45:23 PM com.google.api.client.http.HttpRequest execute
CONFIG: curl -v --compressed -H 'Accept-Encoding: gzip' -H 'Authorization: <Not Logged>' -H 'User-Agent: android-kinvey-http/2.6.8' -H 'x-kinvey-api-version: 3' -H 'x-kinvey-device-information: JAVA/1.6.0_51' -- 'https://baas.kinvey.com/appdata/kid_ePZ9kJuZMi/native/5268356186291fe62c001872'
Oct 23, 2013 4:45:23 PM com.google.api.client.http.HttpResponse <init>
CONFIG: -------------- RESPONSE --------------
HTTP/1.1 200 OK
X-Kinvey-Request-Id: 9dc32d10cec64073bab3d83e0f12709e
X-Kinvey-API-Version: 3
Date: Wed, 23 Oct 2013 20:45:21 GMT
Content-Length: 164
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Server: nginx
X-Powered-By: Express

Oct 23, 2013 4:45:23 PM com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: Total: 164 bytes
Oct 23, 2013 4:45:23 PM com.google.api.client.util.LoggingByteArrayOutputStream close
CONFIG: {"somedata":"hello","_acl":{"creator":"kid_ePZ9kJuZMi"},"_kmd":{"lmt":"2013-10-23T20:45:21.028Z","ect":"2013-10-23T20:45:21.028Z"},"_id":"5268356186291fe62c001872"}
Got a question?