Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1580

logback-access uses response.getStatus improperly

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.3.0
    • None
    • logback-access
    • None

    Description

      The use of HttpServletResponse.getStatus is not reliable for a request logging library.

      The status code is not immutable on the servlet spec and is often reset or change from when the status code was committed (sent over the network) vs when it reaches the request logging implementation in `logback-access`.

      Libraries like spring-framework, spring-mvc, spring-boot, spring-security, all change the status code on the way out of the context dispatch.

      Every decent servlet container tracks the "committed state" of the Request and Response objects and use those values for their own request logging implementation just to ensure that their request logging contains accurate (as seen on the network) information in the request log.

      Example:

      Jetty has `response.getCommittedMetaData().getStatus()` for the status code.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            joakime Joakim Erdfelt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: