• Print
  • Share
  • Dark

How to Collect Servlet Web Request Details

  • Updated on 05 Jul 2018
  • 1 minute to read
  • Contributors

To add additional logging from Servlet Filters follow the instructions in this document, to get the stackify-log-servlet project go to our GitHub Page.

By using a Java Servlet Filter for your Java Apps, you will be able to capture web request details along with your log messages.  

Stackify supports adding filters to J2EE and JAX-RS servlets.

stackify-log-servlet needs to be used in conjunction with one of our java logging libraries.

The web request details will be attached to exceptions that are sent to Retrace. Here are the details that we will capture:

  • User
  • User IP address
  • Server name
  • Request protocol
  • Request method (GET, POST, PUT, DELETE)
  • Request URL
  • Referral URL
  • HTTP headers
  • HTTP cookies (names only)
  • HTTP session attributes (names only)
  • Query string parameters

We do not currently capture any details from the POST/PUT body.

In addition to the web request details, we will also generate a transaction id in the filter. This transaction id will be added to all messages that are logged from that request thread. This gives you an easy way to identify all messages that were logged from the same request.


Add it as a maven dependency:


J2EE Servlet Usage

Add the StackifyLogFilter servlet filter and mapping to the web-app element in your web.xml file.



JAX-RS Servlet Usage

Add the StackifyLogFilter servlet filter to the servlet element in your web.xml file.

Was this article helpful?