Author: pero
Date: Wed Aug 15 13:01:27 2007
New Revision: 566319

URL: http://svn.apache.org/viewvc?view=rev&rev=566319
Log:
Support logging of response headers at AccessLogValve (ex. add %{Set-Cookie}o 
to your pattern)

Modified:
    
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml
    tomcat/container/tc5.5.x/webapps/docs/config/valve.xml

Modified: 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java?view=diff&rev=566319&r1=566318&r2=566319
==============================================================================
--- 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java
 (original)
+++ 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java
 Wed Aug 15 13:01:27 2007
@@ -90,6 +90,7 @@
  * It is modeled after the apache syntax:
  * <ul>
  * <li><code>%{xxx}i</code> for incoming headers
+ * <li><code>%{xxx}o</code> for outgoing headers
  * <li><code>%{xxx}c</code> for a specific cookie
  * <li><code>%{xxx}r</code> xxx is an attribute in the ServletRequest
  * <li><code>%{xxx}s</code> xxx is an attribute in the HttpSession
@@ -105,6 +106,7 @@
  *
  * @author Craig R. McClanahan
  * @author Jason Brittain
+ * @author Peter Rossbach
  * @version $Revision$ $Date$
  */
 
@@ -924,11 +926,22 @@
                 else
                     value= "??";
                 break;
-/*
-            // Someone please make me work
             case 'o':
+                if (null != response) {
+                    String[] values = response.getHeaderValues(header);
+                    if(values.length > 0) {
+                        StringBuffer buf = new StringBuffer() ;
+                        for (int i = 0; i < values.length; i++) {
+                            String string = values[i];
+                            buf.append(string) ;
+                            if(i+1<values.length)
+                                buf.append(",");
+                        }
+                        value = buf.toString();
+                    }
+                } else
+                    value= "??";
                 break;
-*/
             case 'c':
                  Cookie[] c = request.getCookies();
                  for (int i=0; c != null && i < c.length; i++){

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=566319&r1=566318&r2=566319
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Wed Aug 15 13:01:27 2007
@@ -80,6 +80,9 @@
       <fix>
         Improve large-file support (more then 4 Gb) at all AccessLogValves. 
(pero)
       </fix>
+      <update>
+        <bug>43129</bug>: Support logging of response headers at 
AccessLogValve (ex. add %{Set-Cookie}o to your pattern). (pero)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Jasper">

Modified: tomcat/container/tc5.5.x/webapps/docs/config/valve.xml
URL: 
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/config/valve.xml?view=diff&rev=566319&r1=566318&r2=566319
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/config/valve.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/config/valve.xml Wed Aug 15 13:01:27 
2007
@@ -180,11 +180,12 @@
 
     <p>
     There is also support to write information from the cookie, incoming
-    header, the Session or something else in the ServletRequest.
+    header, outgoing response headers, the Session or something else in the 
ServletRequest.
     It is modeled after the apache syntax:
     <ul>
-    <li><b><code>%{xxx}i</code></b> for incoming headers</li>
-    <li><b><code>%{xxx}c</code></b> for a specific cookie</li>
+    <li><b><code>%{xxx}i</code></b> for incoming request headers</li>
+    <li><b><code>%{xxx}o</code></b> for outgoing response headers</li>
+    <li><b><code>%{xxx}c</code></b> for a specific request cookie</li>
     <li><b><code>%{xxx}r</code></b> xxx is an attribute in the 
ServletRequest</li>
     <li><b><code>%{xxx}s</code></b> xxx is an attribute in the HttpSession</li>
     </ul>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to