Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detailed debug logs with Volley

In Restkit on iOS there is a verbose debug option. RKLogConfigureByName("*", RKLogLevelTrace);. Does anyone know if there is an equivalent for Volley. Basically I am going straight to the ErrorListener but I get no additional info in LogCat. Both:

VolleyLog.e("Error: ", error.toString());

And:

VolleyLog.e("Error: ", error.getMessage());

Prints:

2.onErrorResponse: Error: 
like image 751
Mika Avatar asked Mar 20 '14 17:03

Mika


4 Answers

If you want verbose Log from the volley library, you have to use adb

adb -s 42f63b0de7318fe1 shell setprop log.tag.Volley VERBOSE

where "42f63b0de7318fe1" is your device id which you will get by

adb devices

If you want to persist this setting use

adb -s 42f63b0de7318fe1 shell setprop persist.log.tag.Volley VERBOSE

If you have only 1 device you can omit the -s argument

see also How to set ADT system property in eclipse so it always runs

Kill and restart your app to apply the setting.

like image 102
Patrick Favre Avatar answered Oct 19 '22 20:10

Patrick Favre


If you like Volley to output debug messages, you can simply set

VolleyLog.DEBUG = true;

then you will see all verbose log of Volley in out adb logcat output.

like image 20
Kannan Loganathan Avatar answered Oct 19 '22 19:10

Kannan Loganathan


Use

VolleyLog.v("TAG", "Message"); 

for verbose debug option.

And to get other details you will have to try various options available with error object. Do CTRL + SPACE and go on a trial and error tour. :)

For example,

error.networkResponse.statusCode

will give the error code like 404 for page not found.

And, we can also use various Error Classes provided by Volley to check the type of error using

 if(error instanceOf TimeoutError ){
    // you got timed out  
 }

More details here. Have fun and Welcome to Android :)

like image 43
Atul O Holic Avatar answered Oct 19 '22 18:10

Atul O Holic


What works for me as of Jan 2015 is

adb -s 0650ac52006b62db shell setprop Volley VERBOSE

"0650ac52006b62db" is the device id that you get with

adb devices

"Volley" is the name of the TAG that Volley has.

like image 20
tmin Avatar answered Oct 19 '22 19:10

tmin