Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@jakarta.apache.org Received: (qmail 45350 invoked by uid 500); 25 Oct 2001 21:21:55 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: tomcat-dev@jakarta.apache.org Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 45339 invoked by uid 500); 25 Oct 2001 21:21:55 -0000 Delivered-To: apmail-jakarta-tomcat-4.0-cvs@apache.org Date: 25 Oct 2001 21:13:45 -0000 Message-ID: <20011025211345.21940.qmail@icarus.apache.org> From: amyroh@apache.org To: jakarta-tomcat-4.0-cvs@apache.org Subject: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves AccessLogValve.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 tal@zapta.com (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 *
  • %r - First line of the request *
  • %s - HTTP status code of the response + *
  • %S - User session ID *
  • %t - Date and time, in Common Log Format format *
  • %u - Remote user that was authenticated *
  • %U - 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();