Home » Android » java – print All request log called from volley library

java – print All request log called from volley library

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am using volley library to call rest web services and I am using post and get but I don’t know why I am sending post and it received as post from the server side so I want to print all requests that are done bu this library like

[30/Jul/2013:12:28:09 +0000] "POST /app HTTP/1.1" 302 0

[30/Jul/2013:12:28:09 +0000] "GET /app/ HTTP/1.1" 200 0

How can I do that ?

enter image description here

I debugged volley and I don’t know why the method becomes get , in the request variable the mMethod is 1 and in the connection variable the method becomes Get !

I discovered that there is a redirection from the server side , is it possible that I know if there is a redirection or not from volley

How to&Answers:

Volley prints out information using Log.isLoggable(). This function is kind of weird, so in order to see the volley logs you need to do the following:

  1. (Optional) Change the volley tag to whatever you like using VollyLog.setTag("MyTag"). The default tag is "Volley".
  2. Connect your device to your computer and use the terminal / cmd to call adb shell in the adb location (platform-tools library by default).
  3. In the adb shell type the following command: setprop log.tag.MyTag VERBOSE (“MyTag” should be replaced with whatever your tag is according to step 1).

The Volley logs will now be printed out.

Note that this sometimes gets reset, so you’ll need to do it again. I think whenever you restart your phone.