Author: mmillson
Date: 2010-12-09 23:35:45 -0500 (Thu, 09 Dec 2010)
New Revision: 1622
Modified:
branches/JBOSSWEB_2_0_0_GA_CP09_JBPAPP-5562/src/share/classes/org/apache/catalina/valves/AccessLogValve.java
Log:
Add thread name logging pattern to AccessLogValve capabilities for [JBPAPP-5562].
Modified:
branches/JBOSSWEB_2_0_0_GA_CP09_JBPAPP-5562/src/share/classes/org/apache/catalina/valves/AccessLogValve.java
===================================================================
---
branches/JBOSSWEB_2_0_0_GA_CP09_JBPAPP-5562/src/share/classes/org/apache/catalina/valves/AccessLogValve.java 2010-12-10
04:13:08 UTC (rev 1621)
+++
branches/JBOSSWEB_2_0_0_GA_CP09_JBPAPP-5562/src/share/classes/org/apache/catalina/valves/AccessLogValve.java 2010-12-10
04:35:45 UTC (rev 1622)
@@ -43,6 +43,7 @@
import org.apache.catalina.connector.Response;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;
+import org.apache.coyote.RequestInfo;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -79,6 +80,7 @@
* <li><b>%v</b> - Local server name
* <li><b>%D</b> - Time taken to process the request, in millis
* <li><b>%T</b> - Time taken to process the request, in seconds
+ * <li><b>%I</b> - current Request thread name (can compare later with
stacktraces)
* </ul>
* <p>In addition, the caller can specify one of the following aliases for
* commonly utilized patterns:</p>
@@ -868,6 +870,7 @@
.getString("accessLogValve.notStarted"));
lifecycle.fireLifecycleEvent(STOP_EVENT, null);
started = false;
+
close();
}
@@ -881,6 +884,21 @@
}
/**
+ * write thread name - %I
+ */
+ protected class ThreadNameElement implements AccessLogElement {
+ public void addElement(StringBuffer buf, Date date, Request request,
+ Response response, long time) {
+ RequestInfo info = request.getCoyoteRequest().getRequestProcessor();
+ if(info != null) {
+ buf.append(info.getWorkerThreadName());
+ } else {
+ buf.append("-");
+ }
+ }
+ }
+
+ /**
* write local IP address - %A
*/
protected class LocalAddrElement implements AccessLogElement {
@@ -1401,6 +1419,8 @@
return new RequestURIElement();
case 'v':
return new LocalServerNameElement();
+ case 'I':
+ return new ThreadNameElement();
default:
return new StringElement("???" + pattern + "???");
}
Show replies by date