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

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 3e8f97605f Add the new identifier to JSON access log
3e8f97605f is described below

commit 3e8f97605ffa5640eb09a27dbff3a004ae647aa4
Author: remm <r...@apache.org>
AuthorDate: Tue Feb 25 16:02:41 2025 +0100

    Add the new identifier to JSON access log
---
 java/org/apache/catalina/valves/JsonAccessLogValve.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/java/org/apache/catalina/valves/JsonAccessLogValve.java 
b/java/org/apache/catalina/valves/JsonAccessLogValve.java
index 7777d94770..9b95892c9c 100644
--- a/java/org/apache/catalina/valves/JsonAccessLogValve.java
+++ b/java/org/apache/catalina/valves/JsonAccessLogValve.java
@@ -67,6 +67,7 @@ import org.apache.tomcat.util.json.JSONFilter;
  * <li>%{xxx}o: responseHeaders</li>
  * <li>%{xxx}r: requestAttributes</li>
  * <li>%{xxx}s: sessionAttributes</li>
+ * <li>%{xxx}L: identifier</li>
  * </ul>
  * The attribute list is based on 
https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/parser_apache2.rb#L72
  */
@@ -108,6 +109,7 @@ public class JsonAccessLogValve extends AccessLogValve {
         pattern2AttributeName.put(Character.valueOf('o'), "responseHeaders");
         pattern2AttributeName.put(Character.valueOf('r'), "requestAttributes");
         pattern2AttributeName.put(Character.valueOf('s'), "sessionAttributes");
+        pattern2AttributeName.put(Character.valueOf('L'), "identifier");
         SUB_OBJECT_PATTERNS = 
Collections.unmodifiableMap(pattern2AttributeName);
     }
 
@@ -179,6 +181,9 @@ public class JsonAccessLogValve extends AccessLogValve {
             } else if (ale instanceof CookieElement) {
                 
subTypeLists.get(Character.valueOf('c')).add(wrappedLogElement);
                 lit.remove();
+            } else if (ale instanceof IdentifierElement) {
+                
subTypeLists.get(Character.valueOf('L')).add(wrappedLogElement);
+                lit.remove();
             } else {
                 // Keep the simple items and add separator
                 lit.add(new CharElement(','));


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

Reply via email to