Tomcat Debugging Tips : Trace Full request content of all coming requests
Most of time the tomcat access log doesn’t provide full content of a request catched by tomcat server.
So to get a full view of content requests (with headers, cookies, parameters ….) you can use the following configuration.
1 – Add this configuration on web.xml file
<!--filters-->
<filter>
<filter-name>requestdumper</filter-name>
<filter-class>
org.apache.catalina.filters.RequestDumperFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>requestdumper</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
2 – Restart your Server
3 – Then you will get console logs like following :
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 method=GET
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 parameter=_=1567129108463
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 pathInfo=null
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 protocol=HTTP/1.1
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 queryString=_=1567129108463
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 remoteAddr=127.0.0.1
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 remoteHost=127.0.0.1
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 remoteUser=null
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 requestedSessionId=null
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 scheme=https
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 serverName=local.wonderbox.fr
Aug 30, 2019 3:48:31 AM org.apache.catalina.filters.RequestDumperFilter doLog
INFO: hybrisHTTP7 serverPort=9001
Java/JavaEE (Hybris/Spring) & Full Stack Senior Developer
I’m passionate about new technologies or any kind of thing that change our lifestyle to better either by automatisation of existing process or creating new solution.