Hi, Peter.
I noticed that AccessLogValve cannot print the byte size correctly
after your patch.

ex.)

/jsp-examples/index.html is 16764 bytes.

before applying patch.
127.0.0.1 - - [17/Aug/2007:17:58:21 +0900] "GET
/jsp-examples/index.html HTTP/1.1" 200 16764

after applying patch.
127.0.0.1 - - [17/Aug/2007:17:55:41 +0900] "GET
/jsp-examples/index.html HTTP/1.1" 200 16384

Regards,

On 8/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Author: pero
> Date: Mon Aug 13 11:12:51 2007
> New Revision: 565463
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=565463
> Log:
> Improve large-file support (more then 4 Gb) at all AccessLogValves.
>
> Modified:
>     
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java
>     
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/ExtendedAccessLogValve.java
>     
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/FastCommonAccessLogValve.java
>     
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/JDBCAccessLogValve.java
>     tomcat/container/tc5.5.x/webapps/docs/changelog.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=565463&r1=565462&r2=565463
> ==============================================================================
> --- 
> 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
>  Mon Aug 13 11:12:51 2007
> @@ -120,7 +120,7 @@
>       * Construct a new instance of this class with default property values.
>       */
>      public AccessLogValve() {
> -
> +
>          super();
>          setPattern("common");
>
> @@ -599,8 +599,7 @@
>
>              result.append(space);
>
> -            int length = response.getContentCount();
> -
> +            long length = response.getCoyoteResponse().getBytesWritten() ;
>              if (length <= 0)
>                  value = "-";
>              else
> @@ -805,13 +804,15 @@
>                  value = "127.0.0.1";
>              }
>          } else if (pattern == 'b') {
> -            int length = response.getContentCount();
> +            //int length = response.getContentCount();
> +            long length = response.getCoyoteResponse().getBytesWritten() ;
>              if (length <= 0)
>                  value = "-";
>              else
>                  value = "" + length;
>          } else if (pattern == 'B') {
> -            value = "" + response.getContentLength();
> +            //value = "" + response.getContentLength();
> +            value = "" + response.getCoyoteResponse().getBytesWritten();
>          } else if (pattern == 'h') {
>              value = request.getRemoteHost();
>          } else if (pattern == 'H') {
>
> Modified: 
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/ExtendedAccessLogValve.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/ExtendedAccessLogValve.java?view=diff&rev=565463&r1=565462&r2=565463
> ==============================================================================
> --- 
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/ExtendedAccessLogValve.java
>  (original)
> +++ 
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/ExtendedAccessLogValve.java
>  Mon Aug 13 11:12:51 2007
> @@ -584,7 +584,7 @@
>                      else if (FieldInfo.SPECIAL_TIME==fieldInfos[i].location)
>                          result.append(timeFormatter.format(date));
>                      else if 
> (FieldInfo.SPECIAL_BYTES==fieldInfos[i].location) {
> -                        int length = response.getContentCount();
> +                        long length = 
> response.getCoyoteResponse().getBytesWritten() ;
>                          if (length > 0)
>                              result.append(length);
>                          else
> @@ -744,7 +744,7 @@
>                              FieldInfo.X_LOC_REQUESTEDSESSIONIDVALID) {
>                      return wrap(""+request.isRequestedSessionIdValid());
>                  } else if 
> (fieldInfo.location==FieldInfo.X_LOC_CONTENTLENGTH) {
> -                    return wrap(""+request.getContentLength());
> +                    return 
> wrap(""+request.getCoyoteRequest().getContentLengthLong());
>                  } else if (fieldInfo.location==
>                              FieldInfo.X_LOC_CHARACTERENCODING) {
>                      return wrap(request.getCharacterEncoding());
>
> Modified: 
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/FastCommonAccessLogValve.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/FastCommonAccessLogValve.java?view=diff&rev=565463&r1=565462&r2=565463
> ==============================================================================
> --- 
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/FastCommonAccessLogValve.java
>  (original)
> +++ 
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/FastCommonAccessLogValve.java
>  Mon Aug 13 11:12:51 2007
> @@ -523,8 +523,8 @@
>
>          result.append(space);
>
> -        int length = response.getContentCount();
> -
> +        long length = response.getCoyoteResponse().getBytesWritten() ;
> +
>          if (length <= 0)
>              value = "-";
>          else
>
> Modified: 
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/JDBCAccessLogValve.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/JDBCAccessLogValve.java?view=diff&rev=565463&r1=565462&r2=565463
> ==============================================================================
> --- 
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/JDBCAccessLogValve.java
>  (original)
> +++ 
> tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/JDBCAccessLogValve.java
>  Mon Aug 13 11:12:51 2007
> @@ -93,6 +93,10 @@
>   * 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.
> @@ -115,7 +119,6 @@
>
>      // ----------------------------------------------------------- 
> Constructors
>
> -
>      /**
>       * Class constructor. Initializes the fields with the default values.
>       * The defaults are:
> @@ -162,7 +165,12 @@
>
>      // ----------------------------------------------------- Instance 
> Variables
>
> -
> +   /**
> +    * Use long contentLength as you have more 4 GB output.
> +    * @since 5.5.25
> +    */
> +    protected boolean useLongContentLength = false ;
> +
>     /**
>       * The connection username to use when trying to connect to the database.
>       */
> @@ -419,6 +427,12 @@
>          this.resolveHosts = new Boolean(resolveHosts).booleanValue();
>      }
>
> +    /**
> +     * @param useLongContentLength the useLongContentLength to set
> +     */
> +    public void setUseLongContentLength(boolean useLongContentLength) {
> +        this.useLongContentLength = useLongContentLength;
> +    }
>
>      // --------------------------------------------------------- Public 
> Methods
>
> @@ -449,7 +463,8 @@
>          String query="";
>          if(request != null)
>              query = request.getRequestURI();
> -        int bytes = response.getContentCount();
> +        long bytes = response.getCoyoteResponse().getBytesWritten() ;
> +
>          if(bytes < 0)
>              bytes = 0;
>          int status = response.getStatus();
> @@ -465,7 +480,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 = "";
>
> 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=565463&r1=565462&r2=565463
> ==============================================================================
> --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
> +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Mon Aug 13 11:12:51 
> 2007
> @@ -37,7 +37,7 @@
>          Correct j.u.l log levels in JULI docs. (rjung)
>        </docs>
>        <update>
> -        Update to Commons Modeler 2.0.1, fix embed release starting issue 
> (pero)
> +        Update to Commons Modeler 2.0.1, fix embed release starting issue. 
> (pero)
>        </update>
>      </changelog>
>    </subsection>
> @@ -76,6 +76,9 @@
>        <fix>
>          <bug>42944</bug>: Correctly handle servlet mappings that use a '+'
>          character as part of the url pattern. (markt)
> +      </fix>
> +      <fix>
> +        Improve large-file support (more then 4 Gb) at all AccessLogValves. 
> (pero)
>        </fix>
>      </changelog>
>    </subsection>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to