Network Logging - Android

Network logs are automatically collected by Instabug when possible. There are many way to configure and manipulate these logs from the code.

Logging HttpUrlConnection Requests

To log network requests, use InstabugNetworkLog then use the following method at the HttpUrlConnection, requestBody and responseBody. A more detailed example can be found here.

Logging HttpUrlConnection Requests

InstabugNetworkLog networkLog = new InstabugNetworkLog();
 networkLog.Log(urlConnection, requestBody, responseBody);

Logging Okhttp Requests

In order to log Okhttp requests, first make sure that you compiled Instabug with a network interceptor. By adding the following to your Gradle:
implementation 'com.instabug.library:instabug-with-okhttp-interceptor:8+'

An example of the implementation can be found on the right hand side of this section.

Logging Okhttp Requests

InstabugOkhttpInterceptor instabugOkhttpInterceptor = new InstabugOkhttpInterceptor();

OkHttpClient client = new OkHttpClient.Builder()
	.addInterceptor(interceptor)
	.addInterceptor(instabugOkhttpInterceptor)
	.build();