-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 send/receive data at DEBUG level #1087
Comments
I want just state it: logging should be performed in debug mode only. Perhaps it requires Do you want to save request/response headers only or the whole bodies? |
Don't really know which case is better, but sometimes you need 101 bytes, and you'll be sad if some "bad library developer" will cut you at 100. I think there definetly should be some options/log levels restrictions for logging all bytes. |
@pohmelie the decision is up to you. |
@asvetlov if debug_info is not None:
logging.debug(...) Also, I read requests/urllib3 sources to see what is going on there. And they are just logging method, url, http version, response status code and response size. So, after that I think request/response content should not be logged, since you can log it on your own in user code. |
Ok, if we need boolean parameter than just Request sending is here: https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/client_reqrep.py#L482 Maybe pushing logging into redirection loop https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/client.py#L182 is cleaner than modifying request/response classes. Let's cope with regular http requests first and add websocket logging in another PR. |
Maybe better solution is to use protocol.send_headers and protocol.HttpResponseParser? Cause this have all headers/cookies in native view. And there is no need to keep «http dicts» in mind. |
Please no. |
Guys, would it be possible to have some kind of logging. I am trying to understand how cookies and sessions get modified in my application and the docs speak about Logging but setting up client logging is totally useless at the moment. Anything is better than something. If you are worried about performance go with the module variable way, but please, something! |
@txomon, unfortunately I still have no time for this, sorry. As I realized this should be done very accurate: be in proper level of abstraction and don't decrease performance too much. |
Just in case, debug level is not used in production, just during
development, therefore the performance shouldn't be that concerning.
Doing it the http.client is by far the most performing solution, although
logging was also quite performing when not logging.
About the abstraction level, the use case of client debugging is usually
used when developing the library, so method, headers and body, and response
status, headers and optionally body are the expected items.
I think I am missing something because design wise it's just copying other
libraries, isn't it?
…On Wed, Feb 8, 2017, 15:07 pohmelie ***@***.***> wrote:
@txomon <https://github.com/txomon>, unfortunately I still have no time
for this, sorry. As I realized this should be done very accurate: be in
proper level of abstraction and don't decrease performance too much.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1087 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAN7mua7iQ5SWrJBytwp868uBeHyIzKbks5radoXgaJpZM4JkQY3>
.
|
Just wanted to toss my vote in here, too. Situations come up for me regularly where some raw request logging would be very helpful. |
What about receiving file objects for debugging? Like With that, the implementation of the actual logging is done by the dev. |
Superseded by #2313 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
This issue is result of aio-libs google group discussion. Since often developer have no server-side code/protocol/api, but trying to reverse client-side by comparing requests/responses, ability to «see what happend» is very important. For insecure connections there is wireshark, but most of services are secure nowadays.
Easiest way is to wrap transport, but I don't really know how this will affect performance.
The text was updated successfully, but these errors were encountered: