Readable debug logging for http requests with spring webclient

后端 未结 3 1001
死守一世寂寞
死守一世寂寞 2021-02-15 12:31

I\'m using Spring reactive WebClient for sending requests to a http server. Inorder to view the underlying request & response that\'s being sent, I enabled debug logging for

3条回答
  •  粉色の甜心
    2021-02-15 13:11

    This is a very subjective question.

    You don't find that format readable/useful, but I do think the opposite for a few reasons. Hexadecimal is really useful here since HTTP can be tricky:

    • it's not always easy to read special chars in logs (character encoding, etc)
    • servers/clients can interpret/parse headers in different ways
    • it's really hard to track down issues when HTTP control characters are involved without that

    It all boils down to really seing what's sent/received over the network, which is usually what you should see if you're looking into a particular issue.

    But I agree that this level of detail should not be the first and only available information for debugging. There should be an intermediate level where you can get the basics about the HTTP exchanges without looking at raw hex data.

    For more on that, please follow the dedicated issue on Reactor Netty.

提交回复
热议问题