Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log all HTTP requests of Tomcat Server?

Is it possible to print all requests to Tomcat and responses from Tomcat in a logfile?

ex:

request

headers: [header1=a, header2=a]

params: [param1=avv, param2=b]

response

status-code = 200

response = its works

like image 327
user155542 Avatar asked Dec 04 '15 17:12

user155542


1 Answers

https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#Request_Dumper_Filter

The Request Dumper Filter logs information from the request and response objects and is intended to be used for debugging purposes.

The following entries in a web application's web.xml would enable the Request Dumper filter for all requests for that web application.

If the entries were added to CATALINA_BASE/conf/web.xml, the Request Dumper Filter would be enabled for all web applications.

<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>
like image 91
daggett Avatar answered Oct 19 '22 11:10

daggett