-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging full http request and response? #348
Comments
This isn't supported today, but it's a valid feature request to consider. The main snag is that individual Android log messages are limited to ~4K in size, which is often smaller than requests and/or responses. You also have to log data which is potentially binary in nature (e.g. by base64 encoding it), and it can be tricky to try and infer whether the data is binary just from the mimetype. In the mean time, if you want to do this, my recommendation would be to use a base Request class common to all of your requests which can handle the logging in whatever format you expect. You could also try to do this at the BaseHttpStack level by extending e.g. HurlStack to log the request/response bodies generically. |
Thanks for considering this! I am auto generating Volley code using https://github.com/OpenAPITools/openapi-generator Maybe if there was a simple global "addRequestResponseListener" in Volley, and if set that would receive a callback on every request and response, that would be great. Then it would be up to the implementor of that interface to figure out any complexities wrt log message size etc. A simple impl which just dumps to System.out could possibly be included? |
I'm not familiar with that project, so I don't know what can be tweaked. But if it's not letting you provide a custom RequestQueue and/or Network (which includes the HttpStack), then that's probably a feature request for that project. |
I don't really want to override all that complex-sounding (!) stuff to do this logging As a comparison, I am using Micronaut as the backend, and it has a http client which I use in my backend tests Docs are here for reference: https://docs.micronaut.io/latest/guide/httpClient.html
... so it's just a very quick config change there |
Similar results for apache http client |
Hi,
More of a question than an issue
Can volley show the full http request / response?
I googled and didn't find an answer.
I already have this: VolleyLog.DEBUG = true
and that does show several logging messages, but not the http traffic
If there is no way to do this currently, please could this be raised as an enhancement?
Thanks,
David
The text was updated successfully, but these errors were encountered: