How to enable wire logging for a java HttpURLConnection traffic?

后端 未结 8 937
离开以前
离开以前 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:53

    To refresh with Java 8 environment:

    Following @sleske answer

    System.setProperty("javax.net.debug","all");
    

    worked for me out of the box.

    Also was @weberjn suggestion of

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

    but not useful if handling with SSL traffic as it dumps encoded stream.

    All other code tricks did not work for me, but maybe not trying enough hard.

提交回复
热议问题