在使用tomcat或spring-boot的过程中,有时候希望看到所有接受到的http信息。
1.配置spring-boot:logging.level.root:debug
在日志中将看到:
Received [GET / HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.75 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, br
Accept-Language: zh,zh-CN;q=0.9,en;q=0.8
Cookie: Idea-20ff9250=5e759ca2-9e56-4a00-9cd5-4d2dd2fed7aa; JSESSIONID=E4100EFA515C7417F8E40992403FBD43
]
在工具中开启debug模式,repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.16/tomcat-embed-core-9.0.16-sources.jar!/org/apache/coyote/http11/Http11InputBuffer.java:386,在此处能