How to enable wire logging for a java HttpURLConnection traffic?

后端 未结 8 939
离开以前
离开以前 2020-11-27 04:56

I\'ve used Jakarta commons HttpClient in another project and I would like the same wire logging output but using the \"standard\" HttpUrlConnection.

I\'ve used Fiddl

相关标签:
8条回答
  • 2020-11-27 05:58

    On the off chance, that you're only interested in getting at the content on the wire (headers, body etc), you might want to give wireshark a go.

    This has the advantage of not having to change any code, though if enabling logging through code was what you're after, this answer is not applicable.

    0 讨论(0)
  • 2020-11-27 06:03

    In Linux you can run the VM under strace:

    strace -o strace.out -s 4096 -e trace=network -f java ...

    0 讨论(0)
提交回复
热议问题