Closed KadamMangesh closed 8 years ago
You need to use OkHttp's Logging Interceptor: https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor#readme
I am following the same. But I could not see request data. All I can see is response data.
this was the problem with android studio. I tried logs in command prompt and its working now. Thanks.
try this client.networkInterceptors().add(new LoggingInterceptor());
@JakeWharton I'm using the HttpLoggingInterceptor but I can't see the logs for my POST request
// Define the interceptor, add authentication headers
Interceptor interceptor = new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request newRequest = chain.request().newBuilder().addHeader(AUTHORIZATION, BEARER +tokenExp).build();
return chain.proceed(newRequest);
}
};
//Loggin Interceptor
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor();
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
// Add the interceptor to OkHttpClient
OkHttpClient client = new OkHttpClient();
client.interceptors().add(httpLoggingInterceptor);
client.interceptors().add(interceptor);
I cant see request data passed in retrofit 2.0 logging. I can see other header information but not the request data. Any idea how to get full logging ?