amyroh 01/10/25 14:13:44
Modified: catalina/src/share/org/apache/catalina/valves
AccessLogValve.java
Log:
Add an optional '%S' item for logging user session id in the access log.
This will allow to better tracking the activities of a single user session.
The purpose is to be able to collect requests that belong to the same session.
Relates to Bug #4247, thanks for the enhancement idea from [EMAIL PROTECTED] (Tal Dayan).
Revision Changes Path
1.12 +9 -1
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java
Index: AccessLogValve.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- AccessLogValve.java 2001/10/23 23:00:51 1.11
+++ AccessLogValve.java 2001/10/25 21:13:44 1.12
@@ -110,6 +110,7 @@
* an empty string
* <li><b>%r</b> - First line of the request
* <li><b>%s</b> - HTTP status code of the response
+ * <li><b>%S</b> - User session ID
* <li><b>%t</b> - Date and time, in Common Log Format format
* <li><b>%u</b> - Remote user that was authenticated
* <li><b>%U</b> - Requested URL path
@@ -128,7 +129,7 @@
*
* @author Craig R. McClanahan
* @author Jason Brittain
- * @version $Revision: 1.11 $ $Date: 2001/10/23 23:00:51 $
+ * @version $Revision: 1.12 $ $Date: 2001/10/25 21:13:44 $
*/
public final class AccessLogValve
@@ -745,6 +746,13 @@
sb.append(req.getProtocol());
}
value = sb.toString();
+ } else if (pattern == 'S') {
+ if (hreq != null)
+ if (hreq.getSession(false) != null)
+ value = hreq.getSession(false).getId();
+ else value = "-";
+ else
+ value = "-";
} else if (pattern == 's') {
if (hres != null)
value = "" + ((HttpResponse) response).getStatus();