I can't seem to find anything in Retrofit docs regarding how to display any Request details.
Specifically, I want to see JSON from POST Request Body.
The problem is that my request to the server fails with no details message, and I suspect that something is wrong on my side.
Maybe there is a better way to achieve this, but you can configure your log level using the RestAdapter.Builder like:
RestAdapter.Builder builder=...
builder.setLogLevel(LogLevel.FULL).setLog(new RestAdapter.Log() {
public void log(String msg) {
Log.i("retrofit", msg);
}
});
here is an updated answer for retrofit 2.0
HttpLoggingInterceptor body = new HttpLoggingInterceptor();
body.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.addInterceptor(body);
OkHttpClient client = builder.build();
retrofit = new Retrofit.Builder()
.baseUrl(baseUrl)
.client(client)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With