I'm using Retrofit 2, I want to know the values or Structure of sending the value to the server. Is there any way where can I put 'system.out.print' so that I can know what Am I sending?
Asked
Active
Viewed 29 times
1
-
1try this https://stackoverflow.com/questions/32514410/logging-with-retrofit-2 – Sergey Jan 24 '18 at 15:37
2 Answers
2
first add this
impletemtaion "com.squareup.okhttp3:logging-interceptor:LATEST_VERSION";
add this
@Provides
@Singleton
public OkHttpClient provideClient(Context mContext, CacheInterceptor cacheInterceptor, HeaderInterceptor headerInterceptor) {
//***************
HttpLoggingInterceptor logger = new HttpLoggingInterceptor();
logger.setLevel(HttpLoggingInterceptor.Level.BODY);
//***************
return new okhttp3.OkHttpClient.Builder()
.addInterceptor(logger)
.addInterceptor(headerInterceptor)
.connectTimeout(Constant.CONNECTTIMEOUT, TimeUnit.SECONDS)
.readTimeout(Constant.READTIMEOUT, TimeUnit.SECONDS)
.writeTimeout(Constant.WRITETIMEOUT, TimeUnit.SECONDS)
.build();
}

ZeroOne
- 8,996
- 4
- 27
- 45
0
Refer to this for HTTPLogging Interceptor for Retrofit 2
https://futurestud.io/tutorials/retrofit-2-log-requests-and-responses

gorp88
- 105
- 14