Tomcat 7 中 RequestDumperValve 的替换

发布于 2024-11-02 00:35:56 字数 88 浏览 9 评论 0原文

Tomcat 7 不支持 Tomcat 6 及更早版本中提供的 RequestDumperValve。

Tomcat 7 中推荐的替代品是什么?

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

What is its recommended replacement in Tomcat 7?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

¢蛋碎的人ぎ生 2024-11-09 00:35:56

为了回答我自己的问题,更广泛的谷歌搜索得出了这个:

RequestDumperValve 已被 RequestDumperFilter 取代,RequestDumperFilter 是
努力用过滤器替换阀门以更加符合规范,以及
因此更加灵活。这是您想要的课程:
org.apache.catalina.filters.RequestDumperFilter

另请参阅:
http://tomcat.apache.org/tomcat-7.0-doc /config/filter.html#Request_Dumper_Filter

请注意,您现在将在 web.xml 中配置此组件,而不是在
上下文.xml。

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.

何时共饮酒 2024-11-09 00:35:56

作为原始答案的附录,这里有更多细节。除非您熟悉 Tomcat 7 中设置logging.properties文件的方式,否则尚不完全清楚如何配置此配置并实际转储到文件。以下是我如何使转储程序工作:

  1. 配置web.xml,如 tomcat 7.0 文档链接所示
  2. 修改logging.properties,如下所示

:将请求转储程序文件处理程序添加到处理程序列表中

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

b.为请求转储程序日志文件添加适当的文件处理代码

# 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

我相信关键步骤是添加对“处理程序”列表的引用。如果您只是添加具有日志记录配置的部分,它似乎不会接受更改并创建文件。

-岩石

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文