tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject svn commit: r575475 - in /tomcat/tc6.0.x/trunk: java/org/apache/catalina/valves/AccessLogValve.java java/org/apache/catalina/valves/JDBCAccessLogValve.java webapps/docs/changelog.xml
Date Thu, 13 Sep 2007 21:43:23 GMT
Author: pero
Date: Thu Sep 13 14:43:22 2007
New Revision: 575475

URL: http://svn.apache.org/viewvc?rev=575475&view=rev
Log:
Improve large-file support (more then 4 Gb) at all AccessLogValves, backport from 5.5.25.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/AccessLogValve.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/AccessLogValve.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/AccessLogValve.java?rev=575475&r1=575474&r2=575475&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/AccessLogValve.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/AccessLogValve.java Thu Sep 13 14:43:22
2007
@@ -1099,7 +1099,7 @@
 
         public void addElement(StringBuffer buf, Date date, Request request,
                 Response response, long time) {
-            int length = response.getContentCount();
+            long length = response.getContentCountLong() ;
             if (length <= 0 && conversion) {
                 buf.append('-');
             } else {

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java?rev=575475&r1=575474&r2=575475&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/valves/JDBCAccessLogValve.java Thu Sep 13
14:43:22 2007
@@ -45,11 +45,11 @@
  * To use, copy into the server/classes directory of the Tomcat installation
  * and configure in server.xml as:
  * <pre>
- * 		&lt;Valve className="org.apache.catalina.valves.JDBCAccessLogValve"
- *        	driverName="<i>your_jdbc_driver</i>"
- *        	connectionURL="<i>your_jdbc_url</i>"
- *        	pattern="combined" resolveHosts="false"
- * 		/&gt;
+ *      &lt;Valve className="org.apache.catalina.valves.JDBCAccessLogValve"
+ *          driverName="<i>your_jdbc_driver</i>"
+ *          connectionURL="<i>your_jdbc_url</i>"
+ *          pattern="combined" resolveHosts="false"
+ *      /&gt;
  * </pre>
  * </p>
  * <p>
@@ -93,6 +93,11 @@
  * INDEX (userAgent)
  * );
  * </pre>
+ * <p>Set JDBCAccessLogValve attribute useLongContentLength="true" as you have more
then 4GB outputs. 
+ * Please, use long SQL datatype at access.bytes attribute.
+ * The datatype of bytes at oracle is <i>number</i> and other databases use <i>bytes
BIGINT NOT NULL</i>.
+ * </p>
+ * 
  * <p>
  * If the table is created as above, its name and the field names don't need 
  * to be defined.
@@ -120,21 +125,21 @@
      * Class constructor. Initializes the fields with the default values.
      * The defaults are:
      * <pre>
-     * 		driverName = null;
-     * 		connectionURL = null;
-     * 		tableName = "access";
-     * 		remoteHostField = "remoteHost";
-     * 		userField = "userName";
-     * 		timestampField = "timestamp";
-     * 		virtualHostField = "virtualHost";
-     * 		methodField = "method";
-     * 		queryField = "query";
-     * 		statusField = "status";
-     * 		bytesField = "bytes";
-     * 		refererField = "referer";
-     * 		userAgentField = "userAgent";
-     * 		pattern = "common";
-     * 		resolveHosts = false;
+     *      driverName = null;
+     *      connectionURL = null;
+     *      tableName = "access";
+     *      remoteHostField = "remoteHost";
+     *      userField = "userName";
+     *      timestampField = "timestamp";
+     *      virtualHostField = "virtualHost";
+     *      methodField = "method";
+     *      queryField = "query";
+     *      statusField = "status";
+     *      bytesField = "bytes";
+     *      refererField = "referer";
+     *      userAgentField = "userAgent";
+     *      pattern = "common";
+     *      resolveHosts = false;
      * </pre>
      */
     public JDBCAccessLogValve() {
@@ -162,7 +167,12 @@
 
     // ----------------------------------------------------- Instance Variables
 
-
+   /**
+    * Use long contentLength as you have more 4 GB output.
+    * @since 6.0.15
+    */
+    protected boolean useLongContentLength = false ;
+    
    /**
      * The connection username to use when trying to connect to the database.
      */
@@ -419,6 +429,19 @@
         this.resolveHosts = new Boolean(resolveHosts).booleanValue();
     }
 
+    /**
+     * get useLongContentLength
+     */
+    public  boolean getUseLongContentLength() {
+        return this.useLongContentLength ;
+    }
+    
+    /**
+     * @param useLongContentLength the useLongContentLength to set
+     */
+    public void setUseLongContentLength(boolean useLongContentLength) {
+        this.useLongContentLength = useLongContentLength;
+    }
 
     // --------------------------------------------------------- Public Methods
 
@@ -449,7 +472,8 @@
         String query="";
         if(request != null)
             query = request.getRequestURI();
-        int bytes = response.getContentCount();
+        
+        long bytes = response.getContentCountLong() ;
         if(bytes < 0)
             bytes = 0;
         int status = response.getStatus();
@@ -478,7 +502,14 @@
                 ps.setTimestamp(3, new Timestamp(getCurrentTimeMillis()));
                 ps.setString(4, query);
                 ps.setInt(5, status);
-                ps.setInt(6, bytes);
+                
+                if(useLongContentLength) {
+                    ps.setLong(6, bytes);                
+                } else {
+                    if (bytes > Integer.MAX_VALUE)
+                        bytes = -1 ;
+                    ps.setInt(6, (int) bytes);
+                }               
                 if (pattern.equals("combined")) {
      
                       String virtualHost = "";
@@ -508,11 +539,11 @@
                 if (conn != null)
                     close();
               }
-    	      numberOfTries--;        
+              numberOfTries--;
            }
         }
 
-    }	
+    }
 
 
     /**
@@ -666,7 +697,7 @@
         started = false;
         
         close() ;
-    	
+
     }
 
 

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=575475&r1=575474&r2=575475&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Thu Sep 13 14:43:22 2007
@@ -27,6 +27,7 @@
     <author email="yoavs@apache.org">Yoav Shapira</author>
     <author email="fhanik@apache.org">Filip Hanik</author>
     <author email="rjung@apache.org">Rainer Jung</author>
+    <author email="pero@apache.org">Peter Rossbach</author>
     <title>Changelog</title>
   </properties>
 
@@ -74,7 +75,10 @@
       <add>
         Support logging of current thread name at AccessLogValve (ex. add %I to your pattern).
         Usefull to compare access logging entry later with a stacktraces. (pero)
-      </add>     
+      </add>
+      <fix>
+        Improve large-file support (more then 4 Gb) at all AccessLogValves, backport from
5.5.25. (pero)
+      </fix>     
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message