为okhttp添加拦截器HttpLoggingInterceptor不打印

   OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder();
        okHttpClient.connectTimeout(10, TimeUnit.SECONDS);
        okHttpClient.addInterceptor(new HttpLoggingInterceptor());
        mRetrofit = new Retrofit.Builder().baseUrl(BASEURL).addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .client(okHttpClient.build()).addConverterFactory(GsonConverterFactory.create()).build();

使用以上方式配置retrofit 在请求服务器时应该打印请求消息体,可是没有。不知为何。求高手解答

你需要这样写

         HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
         logging.setLevel(HttpLoggingInterceptor.Level.BODY);
         httpClient = new OkHttpClient.Builder().addInterceptor(logging).build();

或者自定义个拦截器,
还可以,咱要不要先把log打开