Much of the access log filename can be customized in the Valve
declaration using prefix and suffix, but the date format used for
the filename is hardcoded in the Valve code.

Here's a patch that allows the date format to be specified in
the Valve definition alongside prefix and suffix.

If this patch is accepted, I can put together another patch for
the admin webapp.

See patch below.

Mike Heinrichs



Index: AccessLogValve.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java,v
retrieving revision 1.15
diff -u -r1.15 AccessLogValve.java
--- AccessLogValve.java	22 Nov 2002 20:27:12 -0000	1.15
+++ AccessLogValve.java	15 Jan 2003 19:19:32 -0000
@@ -325,6 +325,11 @@
     private long rotationLastChecked = 0L;


+    /**
+     * The access log filename date format
+     */
+    private String dateFormat = "yyyy-MM-dd";
+
     // ------------------------------------------------------------- Properties


@@ -443,6 +448,28 @@


     /**
+     * Return the date format string used for access log filenames
+     */
+    public String getDateFormat() {
+
+        return (dateFormat);
+
+    }
+
+
+    /**
+     * Set the date format string used for access log filenames
+     *
+     * @param dateFormat The new date format
+     */
+    public void setDateFormat(String dateFormat) {
+
+        this.dateFormat = dateFormat;
+
+    }
+
+
+    /**
      * Return the log file suffix.
      */
     public String getSuffix() {
@@ -1024,7 +1051,7 @@
         if (timeZone.length() < 5)
             timeZone = timeZone.substring(0, 1) + "0" +
                 timeZone.substring(1, timeZone.length());
-        dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
+        dateFormatter = new SimpleDateFormat(this.dateFormat);
         dateFormatter.setTimeZone(tz);
         dayFormatter = new SimpleDateFormat("dd");
         dayFormatter.setTimeZone(tz);


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

Reply via email to