From: timw Date: Tue, 26 Jul 2011 09:41:36 +0000 (+0000) Subject: https://issues.apache.org/bugzilla/show_bug.cgi?id=51545 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1999bc0d49f4c30b9caad376e713ac11daf624c1;p=tomcat7.0 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. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1151043 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java index 5d30bdb9e..50f8382d0 100644 --- a/java/org/apache/catalina/valves/ExtendedAccessLogValve.java +++ b/java/org/apache/catalina/valves/ExtendedAccessLogValve.java @@ -64,6 +64,7 @@ import org.apache.tomcat.util.ExceptionUtils; *
  • sc-status: The status code
  • *
  • time: Time the request was served
  • *
  • time-taken: Time (in seconds) taken to serve the request
  • + *
  • x-threadname: Current request thread name (can compare later with stacktraces)
  • *
  • x-A(XXX): Pull XXX attribute from the servlet context
  • *
  • x-C(XXX): Pull the first cookie of the name XXX
  • *
  • x-O(XXX): Pull the all response header values XXX
  • @@ -745,6 +746,10 @@ public class ExtendedAccessLogValve extends AccessLogValve { 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; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 442e8e50e..7b17529bf 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -76,7 +76,7 @@ <others/> tag when using absolute ordering. (markt) - Move the SetCharacaterEncoding filter from the examples web application + Move the SetCharacterEncoding filter from the examples web application to the org.apache.catalina.filters package so it is available for all web applications. (markt) @@ -90,6 +90,11 @@ 51555: Allow destroy() to be called on Lifecycle components that are in the initialized state. (markt) + + Add x-threadname pattern format token to ExtendedAccessLogValve to log + the current request thread name. Based on a patch from Felix Schumacher. + (timw) + diff --git a/webapps/docs/config/valve.xml b/webapps/docs/config/valve.xml index 4846782a6..d58703eef 100644 --- a/webapps/docs/config/valve.xml +++ b/webapps/docs/config/valve.xml @@ -222,7 +222,7 @@
  • %v - Local server name
  • %D - Time taken to process the request, in millis
  • %T - Time taken to process the request, in seconds
  • -
  • %I - current request thread name (can compare later with stacktraces)
  • +
  • %I - Current request thread name (can compare later with stacktraces)
  • @@ -411,6 +411,7 @@

  • sc-status - HTTP status code of the response
  • time - Time the request was served in HH:mm:ss format for GMT
  • time-taken - Time (in seconds as floating point) taken to serve the request
  • +
  • x-threadname - Current request thread name (can compare later with stacktraces)
  • For any of the x-H(XXX) the following method will be called from the