print从volley库调用的所有请求日志 [英] print All request log called from volley library
问题描述
我正在使用排球库来调用其他网络服务而我正在使用post和get但我不知道为什么我发送帖子并且它从服务器端收到了帖子所以我想要打印所有已完成的请求这个库就像
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
我该怎么做?
我调试了凌空,我不知道为什么方法变得get,在请求变量中,mMethod为1,在连接变量中,方法变为Get!
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
推荐答案
Volley使用 Log.isLoggable()
打印出信息。这个功能很奇怪,所以为了看到齐射日志你需要做以下事情:
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:
- (可选)改变齐射使用
VollyLog.setTag(MyTag)
标记您喜欢的任何内容。默认标签为Volley
。 - 将设备连接到计算机并使用终端/ cmd拨打
adb shell
在adb位置(默认情况下为platform-tools库)。 - 在adb shell中输入以下命令:
setprop log.tag.MyTag VERBOSE
(根据步骤1,MyTag应替换为您的标签)。
- (Optional) Change the volley tag to whatever you like using
VollyLog.setTag("MyTag")
. The default tag is"Volley"
. - Connect your device to your computer and use the terminal / cmd to call
adb shell
in the adb location (platform-tools library by default). - 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).
现在将打印出Volley日志。
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.
这篇关于print从volley库调用的所有请求日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!