Q: HttpLoggingInterceptor is not logging response for OkHttp body for some reason I have OkHttpClient 2.7 with HttpLoggingInterceptor 2.7 from Square. I have created "GET" request that returns json but for some reason the response body is not logged and the result for the response body is only "}". All other stuff as header, content-type, etc is present in the console.
HttpLoggHttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
mHttpClient.interceptors().add(interceptor);

The problem should be in that string:
logger.log(buffer.clone().readString(charset));
--> END GET
<-- HTTP/1.1 200 OK (420ms)
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true
Expires: -1
Server: Microsoft-IIS/8.5
OData-Version: 4.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 24 Dec 2015 17:51:42 GMT
Content-Length: 2291
OkHttp-Sent-Millis: 1450979490431
OkHttp-Received-Millis: 1450979490851
}


A: It seems newlines in a JSON response string are the cause.  Replace
logger.log(buffer.clone().readString(charset));

with:
String[] bufferSplit = buffer.clone().readString(charset).split("\\r?\\n");
for (String s : bufferSplit) {
    logger.log(s);
}

This gives the full response JSON.  I would not recommend doing this in a release build but for development it gets the job done.
