This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 3b0ba0fce3 Add connection ID to the ExtendedAccessLogValve
3b0ba0fce3 is described below

commit 3b0ba0fce33de9dea4f4d9ab109c018a2662868f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Feb 24 12:25:31 2025 +0000

    Add connection ID to the ExtendedAccessLogValve
---
 java/org/apache/catalina/valves/ExtendedAccessLogValve.java | 8 ++++++++
 webapps/docs/config/valve.xml                               | 1 +
 2 files changed, 9 insertions(+)

diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java 
b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
index 28e6d2e5c6..819096df0e 100644
--- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
+++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
@@ -70,6 +70,7 @@ import org.apache.tomcat.util.ExceptionUtils;
  * <li>For any of the x-H(...) the following method will be called from the 
HttpServletRequest object</li>
  * <li><code>x-H(authType)</code>: getAuthType</li>
  * <li><code>x-H(characterEncoding)</code>: getCharacterEncoding</li>
+ * <li><code>x-H(connectionId)</code>: getConnectionId</li>
  * <li><code>x-H(contentLength)</code>: getContentLength</li>
  * <li><code>x-H(locale)</code>: getLocale</li>
  * <li><code>x-H(protocol)</code>: getProtocol</li>
@@ -767,6 +768,13 @@ public class ExtendedAccessLogValve extends AccessLogValve 
{
                     buf.append(wrap("" + request.getContentLengthLong()));
                 }
             };
+        } else if ("connectionId".equals(parameter)) {
+            return new AccessLogElement() {
+                @Override
+                public void addElement(CharArrayWriter buf, Date date, Request 
request, Response response, long time) {
+                    buf.append(wrap("" + 
request.getServletConnection().getConnectionId()));
+                }
+            };
         } else if ("characterEncoding".equals(parameter)) {
             return new AccessLogElement() {
                 @Override
diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml
index def558f94e..add9753ecf 100644
--- a/webapps/docs/config/valve.xml
+++ b/webapps/docs/config/valve.xml
@@ -479,6 +479,7 @@
     <ul>
     <li><b><code>x-H(authType)</code></b>: getAuthType </li>
     <li><b><code>x-H(characterEncoding)</code></b>: getCharacterEncoding </li>
+    <li><b><code>x-H(connectionId)</code></b>: 
getServletConnection().getConnectionId</li>
     <li><b><code>x-H(contentLength)</code></b>: getContentLength </li>
     <li><b><code>x-H(locale)</code></b>:  getLocale</li>
     <li><b><code>x-H(protocol)</code></b>: getProtocol </li>


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

Reply via email to