类 AbstractRequestLoggingFilter

    • 方法详细资料

      • setIncludeQueryString

        public void setIncludeQueryString​(boolean includeQueryString)
        Set whether the query string should be included in the log message.

        Should be configured using an <init-param> for parameter name "includeQueryString" in the filter definition in web.xml.

      • isIncludeQueryString

        protected boolean isIncludeQueryString()
        Return whether the query string should be included in the log message.
      • setIncludeClientInfo

        public void setIncludeClientInfo​(boolean includeClientInfo)
        Set whether the client address and session id should be included in the log message.

        Should be configured using an <init-param> for parameter name "includeClientInfo" in the filter definition in web.xml.

      • isIncludeClientInfo

        protected boolean isIncludeClientInfo()
        Return whether the client address and session id should be included in the log message.
      • setIncludeHeaders

        public void setIncludeHeaders​(boolean includeHeaders)
        Set whether the request headers should be included in the log message.

        Should be configured using an <init-param> for parameter name "includeHeaders" in the filter definition in web.xml.

        从以下版本开始:
        4.3
      • isIncludeHeaders

        protected boolean isIncludeHeaders()
        Return whether the request headers should be included in the log message.
        从以下版本开始:
        4.3
      • setIncludePayload

        public void setIncludePayload​(boolean includePayload)
        Set whether the request payload (body) should be included in the log message.

        Should be configured using an <init-param> for parameter name "includePayload" in the filter definition in web.xml.

        从以下版本开始:
        3.0
      • isIncludePayload

        protected boolean isIncludePayload()
        Return whether the request payload (body) should be included in the log message.
        从以下版本开始:
        3.0
      • setMaxPayloadLength

        public void setMaxPayloadLength​(int maxPayloadLength)
        Set the maximum length of the payload body to be included in the log message. Default is 50 characters.
        从以下版本开始:
        3.0
      • getMaxPayloadLength

        protected int getMaxPayloadLength()
        Return the maximum length of the payload body to be included in the log message.
        从以下版本开始:
        3.0
      • setBeforeMessagePrefix

        public void setBeforeMessagePrefix​(String beforeMessagePrefix)
        Set the value that should be prepended to the log message written before a request is processed.
      • setBeforeMessageSuffix

        public void setBeforeMessageSuffix​(String beforeMessageSuffix)
        Set the value that should be appended to the log message written before a request is processed.
      • setAfterMessagePrefix

        public void setAfterMessagePrefix​(String afterMessagePrefix)
        Set the value that should be prepended to the log message written after a request is processed.
      • setAfterMessageSuffix

        public void setAfterMessageSuffix​(String afterMessageSuffix)
        Set the value that should be appended to the log message written after a request is processed.
      • createMessage

        protected String createMessage​(HttpServletRequest request,
                                       String prefix,
                                       String suffix)
        Create a log message for the given request, prefix and suffix.

        If includeQueryString is true, then the inner part of the log message will take the form request_uri?query_string; otherwise the message will simply be of the form request_uri.

        The final message is composed of the inner part as described and the supplied prefix and suffix.

      • beforeRequest

        protected abstract void beforeRequest​(HttpServletRequest request,
                                              String message)
        Concrete subclasses should implement this method to write a log message before the request is processed.
        参数:
        request - current HTTP request
        message - the message to log
      • afterRequest

        protected abstract void afterRequest​(HttpServletRequest request,
                                             String message)
        Concrete subclasses should implement this method to write a log message after the request is processed.
        参数:
        request - current HTTP request
        message - the message to log