Tomcat Debugging Tips : Trace Full request content of all coming requests

Hybris Logo

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

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of