Replacement for RequestDumperValve in Tomcat 7

后端 未结 2 1348
逝去的感伤
逝去的感伤 2020-12-05 18:31

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

What is its recommended replacement in Tomcat 7?

2条回答
  •  北海茫月
    2020-12-05 18:39

    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

提交回复
热议问题