Replacement for RequestDumperValve in Tomcat 7
Asked Answered
I

2

23

Tomcat 7 does not support the RequestDumperValve that was available Tomcat 6 and earlier.

What is its recommended replacement in Tomcat 7?

Imperceptive answered 15/4, 2011 at 5:56 Comment(0)
I
25

And to answer my own question, more extensive Googling came up with this:

RequestDumperValve has been replaced by RequestDumperFilter, part of an effort to replace Valves with Filters to be more spec-compliant, and therefore more flexible. This is the class you want: org.apache.catalina.filters.RequestDumperFilter

Also see: http://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#Request_Dumper_Filter

Note that you will configure this component in web.xml, now, and not in context.xml.

Imperceptive answered 15/4, 2011 at 6:7 Comment(1)
I have modified tomcat7/conf/web.xml (added dumper filter, tried "/*" and "*" pattern), modified conf/logging.properties. All I get is an empty logs/request-dumper.log file. Nothing if actually logged.Occupation
I
22

As an addendum to the original answer, here is a little bit more detail. It isn't fully clear how to get this configured and actually dumping to a file unless you are familiar with the way the logging.properties file is set up in Tomcat 7. Here is how I was able to get the dumper working:

  1. Configure the web.xml as shown in the link to the tomcat 7.0 docs
  2. Modify the logging.properties as follows:

a. Add the request dumper file handler to the list of handlers

handlers = ... , 5request-dumper.org.apache.juli.FileHandler, ...

b. Add in the appropriate file handling code for the request-dumper log file

# request dumper configuration
5request-dumper.org.apache.juli.FileHandler.level = INFO
5request-dumper.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
5request-dumper.org.apache.juli.FileHandler.prefix = request-dumper.
5request-dumper.org.apache.juli.FileHandler.formatter = org.apache.juli.VerbatimFormatter
org.apache.catalina.filters.RequestDumperFilter.level = INFO
org.apache.catalina.filters.RequestDumperFilter.handlers = 5request-dumper.org.apache.juli.FileHandler

I believe the key step is adding in your reference to the "handlers" list. If you just add in the section with the logging configuration it doesn't appear to pick up the changes and create the file.

-rOcK

Intake answered 4/1, 2012 at 13:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.