You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by zemian <gi...@git.apache.org> on 2017/07/21 03:13:43 UTC

[GitHub] tomcat pull request #70: Add new accesslog valve pattern %X for recording co...

GitHub user zemian opened a pull request:

    https://github.com/apache/tomcat/pull/70

    Add new accesslog valve pattern %X for recording connection status

    - https://bz.apache.org/bugzilla/show_bug.cgi?id=61164

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/zemian/tomcat zemian_61164-accesslog

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tomcat/pull/70.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #70
    
----
commit 63e749b4d57c9d38ce2b6dc3e8fd54f200f60d61
Author: Zemian Deng <ze...@bnymellon.com>
Date:   2017-07-21T03:10:53Z

    Add new accesslog valve pattern %X for recording connection status
    
    - https://bz.apache.org/bugzilla/show_bug.cgi?id=61164

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] tomcat issue #70: Add new accesslog valve pattern %X for recording connectio...

Posted by markt-asf <gi...@git.apache.org>.
Github user markt-asf commented on the issue:

    https://github.com/apache/tomcat/pull/70
  
    Patch applied. Many thanks.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] tomcat pull request #70: Add new accesslog valve pattern %X for recording co...

Posted by markt-asf <gi...@git.apache.org>.
Github user markt-asf commented on a diff in the pull request:

    https://github.com/apache/tomcat/pull/70#discussion_r129111529
  
    --- Diff: java/org/apache/catalina/valves/AbstractAccessLogValve.java ---
    @@ -1506,6 +1508,38 @@ public void addElement(CharArrayWriter buf, Date date, Request request,
             }
         }
     
    +    /**
    +     * Write connection status when response is completed - %X
    +     */
    +    protected static class ConnectionStatusElement implements AccessLogElement {
    +        @Override
    +        public void addElement(CharArrayWriter buf, Date date, Request request, Response response, long time) {
    +            if (response != null && request != null) {
    +                // Check for connection aborted cond
    +                boolean isConnAborted = false;
    +                if (response.isError()) {
    +                    Throwable ex = (Throwable)request.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
    +                    if (ex instanceof ClientAbortException) {
    +                        isConnAborted = true;
    +                        buf.append('X');
    +                    }
    +                }
    +
    +                // Check whether connection is keep-alive or not
    +                if (!isConnAborted) {
    +                    if (org.apache.coyote.http11.Constants.KEEPALIVE.equals(
    +                            request.getHeader(org.apache.coyote.http11.Constants.CONNECTION))) {
    --- End diff --
    
    The log message is intended to show if the connection remains in keep-alive after the current request finishes. You want to look at the Connection header (for close) on the response here to mimic the behaviour described for httpd.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] tomcat pull request #70: Add new accesslog valve pattern %X for recording co...

Posted by markt-asf <gi...@git.apache.org>.
Github user markt-asf closed the pull request at:

    https://github.com/apache/tomcat/pull/70


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org