Retrofit @GET - how to display request string?

call.request().url(), where call is type of retrofit2.Call.


Yes, you can enable debug logging by calling setLogLevel() on your RestAdapter.

I typically set logging to LogLevel.FULL for debug builds like so:

RestAdapter adapter = builder.setEndpoint("example.com")
    .setLogLevel(BuildConfig.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE)
    .build();

This will automatically print out all of the information associated with your HTTP requests, including the URL you are hitting, the headers, and the body of both the request and the response.


RetrofitError has a getUrl() method that returns the URL.

Also the Response has a getUrl() method as well within the callback.

That, and you can also specify the log level as per this question:

RestAdapter adapter = (new RestAdapter.Builder()).
//...
           setLogLevel(LogLevel.FULL).setLog(new AndroidLog("YOUR_LOG_TAG"))              

Although based on the docs, LogLevel.BASIC should do what you need.

BASIC
Log only the request method and URL and the response status code and execution time.