You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ti...@apache.org on 2011/07/26 11:41:37 UTC

svn commit: r1151043 - in /tomcat/trunk: java/org/apache/catalina/valves/ExtendedAccessLogValve.java webapps/docs/changelog.xml webapps/docs/config/valve.xml

Author: timw
Date: Tue Jul 26 09:41:36 2011
New Revision: 1151043

URL: http://svn.apache.org/viewvc?rev=1151043&view=rev
Log:
https://issues.apache.org/bugzilla/show_bug.cgi?id=51545

Adding ability to log current request thread name in ExtendedAccessLogValve using Tomcat specific x-threadname pattern format token.

Modified:
    tomcat/trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
    tomcat/trunk/webapps/docs/changelog.xml
    tomcat/trunk/webapps/docs/config/valve.xml

Modified: tomcat/trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java?rev=1151043&r1=1151042&r2=1151043&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/ExtendedAccessLogValve.java Tue Jul 26 09:41:36 2011
@@ -64,6 +64,7 @@ import org.apache.tomcat.util.ExceptionU
  * <li><code>sc-status</code>:  The status code</li>
  * <li><code>time</code>:  Time the request was served</li>
  * <li><code>time-taken</code>:  Time (in seconds) taken to serve the request</li>
+ * <li><code>x-threadname</code>: Current request thread name (can compare later with stacktraces)</li>
  * <li><code>x-A(XXX)</code>: Pull XXX attribute from the servlet context </li>
  * <li><code>x-C(XXX)</code>: Pull the first cookie of the name XXX </li>
  * <li><code>x-O(XXX)</code>: Pull the all response header values XXX </li>
@@ -745,6 +746,10 @@ public class ExtendedAccessLogValve exte
             return null;
         }
         String token = tokenizer.getToken();
+        if ("threadname".equals(token)) {
+            return new ThreadNameElement();
+        }
+
         if (!tokenizer.hasParameter()) {
             log.error("x param in wrong format. Needs to be 'x-#(...)' read the docs!");
             return null;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1151043&r1=1151042&r2=1151043&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Jul 26 09:41:36 2011
@@ -76,7 +76,7 @@
         &lt;others/&gt; tag when using absolute ordering. (markt)
       </fix>
       <add>
-        Move the SetCharacaterEncoding filter from the examples web application
+        Move the SetCharacterEncoding filter from the examples web application
         to the <code>org.apache.catalina.filters</code> package so it is
         available for all web applications. (markt)
       </add>
@@ -90,6 +90,11 @@
         <bug>51555</bug>: Allow destroy() to be called on Lifecycle components
         that are in the initialized state. (markt)
       </fix>
+      <add>
+        Add x-threadname pattern format token to ExtendedAccessLogValve to log
+        the current request thread name. Based on a patch from Felix Schumacher.
+        (timw)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Coyote">

Modified: tomcat/trunk/webapps/docs/config/valve.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/valve.xml?rev=1151043&r1=1151042&r2=1151043&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/valve.xml (original)
+++ tomcat/trunk/webapps/docs/config/valve.xml Tue Jul 26 09:41:36 2011
@@ -222,7 +222,7 @@
     <li><b>%v</b> - Local server name</li>
     <li><b>%D</b> - Time taken to process the request, in millis</li>
     <li><b>%T</b> - Time taken to process the request, in seconds</li>
-    <li><b>%I</b> - current request thread name (can compare later with stacktraces)</li>
+    <li><b>%I</b> - Current request thread name (can compare later with stacktraces)</li>
     </ul>
 
     <p>
@@ -411,6 +411,7 @@
     <li><b>sc-status</b> - HTTP status code of the response</li>
     <li><b>time</b> - Time the request was served in HH:mm:ss format for GMT</li>
     <li><b>time-taken</b> - Time (in seconds as floating point) taken to serve the request</li>
+    <li><b>x-threadname</b> - Current request thread name (can compare later with stacktraces)</li>
     </ul>
 
     <p>For any of the <code>x-H(XXX)</code> the following method will be called from the



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