简体   繁体   English

泽西在tomcat中记录请求体

[英]Jersey logging request body in tomcat

I am having issues getting the request body xml/json logged by jersey. 我有问题获得由泽西记录的请求正文xml / json。 I have added 我已经添加了

    </init-param>
    <init-param>
        <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
        <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
    </init-param>
    <init-param>
        <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
        <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
    </init-param>
    <init-param>
        <param-name>jersey.config.server.provider.classnames</param-name>
        <param-value>org.glassfish.jersey.filter.LoggingFilter</param-value>
    </init-param>

in web.xml. 在web.xml中。 I see as below 我看如下

INFO: 5 * LoggingFilter - Request received on thread catalina-exec-677
5 > POST http://testserver:61001/test-8.1.0.0-SNAPSHOT/des/v1
5 > accept-encoding: gzip,deflate
5 > content-type: application/json
5 > content-length: 1504
5 > host: dimw-desproxy101:61001
5 > connection: Keep-Alive
5 > user-agent: Apache-HttpClient/4.1.1 (java 1.5)

Dec 04, 2013 7:44:49 PM org.glassfish.jersey.filter.LoggingFilter log
INFO: 5 * LoggingFilter - Response received on thread catalina-exec-677
5 < 200
5 < Content-Type: application/xml

but not the request body 但不是请求机构

See https://java.net/jira/browse/JERSEY-749?focusedCommentId=366719&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_366719 请参阅https://java.net/jira/browse/JERSEY-749?focusedCommentId=366719&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_366719 -

Resolving as won't fix as this seems to be only related to Tomcat and there is a known workaround. 因为这似乎只与Tomcat有关并且有一个已知的解决方法。 I believe entity logging is needed for debug purpose only, and there the workaround should not hurt. 我认为实体日志记录仅用于调试目的,并且解决方法不应该受到伤害。 Please re-open, if you have strong objections. 如果您有强烈的反对意见,请重新开放。

The workaround provided is to use the HttpNioProtocol connector. 提供的解决方法是使用HttpNioProtocol连接器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM