You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2011/07/10 13:22:40 UTC

svn commit: r1144833 - in /tomcat/trunk: java/org/apache/catalina/valves/AccessLogValve.java webapps/docs/changelog.xml

Author: rjung
Date: Sun Jul 10 11:22:40 2011
New Revision: 1144833

URL: http://svn.apache.org/viewvc?rev=1144833&view=rev
Log:
Another regression in 7.0.18: year number formatting
in AccessLogValve is broken due to type "yyy" instead of "yyyy".

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

Modified: tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java?rev=1144833&r1=1144832&r2=1144833&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java Sun Jul 10 11:22:40 2011
@@ -263,7 +263,7 @@ public class AccessLogValve extends Valv
         private class Cache {
 
             /* CLF log format */
-            private static final String cLFFormat = "dd/MMM/yyy:HH:mm:ss";
+            private static final String cLFFormat = "dd/MMM/yyyy:HH:mm:ss";
 
             /* Second used to retrieve CLF format in most recent invocation */
             private long previousSeconds = 0L;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1144833&r1=1144832&r2=1144833&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Sun Jul 10 11:22:40 2011
@@ -71,6 +71,9 @@
       <add>
         Add option to activate AccessLog for unit tests. (rjung)
       </add>
+      <fix>
+        Fix regression in year number formatting for AccessLogValve. (rjung)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">



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


Re: svn commit: r1144833 - in /tomcat/trunk: java/org/apache/catalina/valves/AccessLogValve.java webapps/docs/changelog.xml

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/7/11 Rainer Jung <ra...@kippdata.de>:
>
>> There is another enhancement on todo list:
>> provide "encoding" option for AccessLogValve,
>> like already done for FileHandler in JULI.
>
> I guess that is https://issues.apache.org/bugzilla/show_bug.cgi?id=46252
>
> The need for it isn't very convincing, at least after only looking at
> bugzilla.

I implemented BZ 46252.
The motivation is that if you use some custom locale there is a chance
that the symbols that it produces wouldn't be supported by the default
charset, thus without that option you might end with  '???' for a
month name.


BTW,  ExtendedAccessLogValve#ElementTimestampStruct probably will have
the same issue with locales. I have not tested it, though.

Best regards,
Konstantin Kolinko

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


Re: svn commit: r1144833 - in /tomcat/trunk: java/org/apache/catalina/valves/AccessLogValve.java webapps/docs/changelog.xml

Posted by Rainer Jung <ra...@kippdata.de>.
On 11.07.2011 12:35, Konstantin Kolinko wrote:
> 2011/7/11 Rainer Jung <ra...@kippdata.de>:
>> On 11.07.2011 01:24, Konstantin Kolinko wrote:

>> I suggest we at least make the behaviour consistent:
>>
>> - Change the defaults to en_US
> 
> I think it has to be en_US.

Right. CLF will now always use en_US. Fortunately the Java 6 javadocs
include the information, that Locale.US always has to exist.

I also use Locale.US for formatting the timestamp that is part of the
file name. That seems to be consistent with timestamps in other Tomcat
log file names.

>> - Allow to overwrite the locale used for formatting the lines in
>>  the access log
> 
> Maybe, but I think that nobody asked.

Committed in r1145166. By default all timestamps configured using an
explicit SimpleDateFormat %{xxx}t will be formatted using the default
locale. That is similar to e.g. timestamps contained in other log files.

> There is another enhancement on todo list:
> provide "encoding" option for AccessLogValve,
> like already done for FileHandler in JULI.

I guess that is https://issues.apache.org/bugzilla/show_bug.cgi?id=46252

The need for it isn't very convincing, at least after only looking at
bugzilla.

Regards,

Rainer

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


Re: svn commit: r1144833 - in /tomcat/trunk: java/org/apache/catalina/valves/AccessLogValve.java webapps/docs/changelog.xml

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/7/11 Rainer Jung <ra...@kippdata.de>:
> On 11.07.2011 01:24, Konstantin Kolinko wrote:
>> 2011/7/10  <rj...@apache.org>:
>>> Author: rjung
>>> Date: Sun Jul 10 11:22:40 2011
>>> New Revision: 1144833
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1144833&view=rev
>>> Log:
>>> Another regression in 7.0.18: year number formatting
>>> in AccessLogValve is broken due to type "yyy" instead of "yyyy".
>>>
>>
>> Nice catch.
>
> Don't know why I did not notice that earlier. I looked at access log
> lines a lot since that buggy change, but only noticed it yesterday.
>
>> There is one more regression there:  month names are now localized
>> and may be printed not in English, but in other languages.
>>
>> 127.0.0.1 - - [09/июл/11:00:48:22 +0400] "GET /examples/ HTTP/1.1" 200 1156
>
> Oha, getting fun here: I checked 7.0.16 (before the ALV change) with
> default locale th_TH_TH, which changes about everything, including digits.
>
> That will produce
>
> - english months
>
> - thai digits in request timestamp, but also in the default
>  file suffix timestamp (rendered here as "?", so effectively
>  breaking file rotation - but only since that locale is not fully
>  available here).
>
> I suggest we at least make the behaviour consistent:
>
> - Change the defaults to en_US

I think it has to be en_US.

The javadoc of AccessLogValve says:
%t - Date and time, in Common Log Format format

I think that Common Log Format expects English months and digits.
http://httpd.apache.org/docs/current/logs.html#accesslog


> - Allow to overwrite the locale used for formatting the lines in
>  the access log *and also* the file sufix

Maybe, but I think that nobody asked.

There is another enhancement on todo list:
provide "encoding" option for AccessLogValve,
like already done for FileHandler in JULI.

>
> Unfortunately I could find only one reference, that en_US support is
> mandatory for a JVM:
>
> http://java.sun.com/developer/technicalArticles/J2SE/locale/
>
> Look for "This list is quite short: English (U.S.)."
>
> If we wanted to make it bullet-proof, we could either switch to the
> default locale completely, but that changes behaviour quite a lot as you
> noticed, or use DateFormatSymbols to just fix the month names. That
> would be the old behaviour with inconsistent formatting.
>
> I suggest we use en_US if available, otherwise the default locale. In
> any case make it overwritable by an attribute. That would give
> consistent behaviour, which on most installations should be as good or
> even better than before.
>

Best regards,
Konstantin Kolinko

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


Re: svn commit: r1144833 - in /tomcat/trunk: java/org/apache/catalina/valves/AccessLogValve.java webapps/docs/changelog.xml

Posted by Rainer Jung <ra...@kippdata.de>.
On 11.07.2011 01:24, Konstantin Kolinko wrote:
> 2011/7/10  <rj...@apache.org>:
>> Author: rjung
>> Date: Sun Jul 10 11:22:40 2011
>> New Revision: 1144833
>>
>> URL: http://svn.apache.org/viewvc?rev=1144833&view=rev
>> Log:
>> Another regression in 7.0.18: year number formatting
>> in AccessLogValve is broken due to type "yyy" instead of "yyyy".
>>
> 
> Nice catch.

Don't know why I did not notice that earlier. I looked at access log
lines a lot since that buggy change, but only noticed it yesterday.

> There is one more regression there:  month names are now localized
> and may be printed not in English, but in other languages.
> 
> 127.0.0.1 - - [09/июл/11:00:48:22 +0400] "GET /examples/ HTTP/1.1" 200 1156

Oha, getting fun here: I checked 7.0.16 (before the ALV change) with
default locale th_TH_TH, which changes about everything, including digits.

That will produce

- english months

- thai digits in request timestamp, but also in the default
  file suffix timestamp (rendered here as "?", so effectively
  breaking file rotation - but only since that locale is not fully
  available here).

I suggest we at least make the behaviour consistent:

- Change the defaults to en_US
- Allow to overwrite the locale used for formatting the lines in
  the access log *and also* the file sufix

Unfortunately I could find only one reference, that en_US support is
mandatory for a JVM:

http://java.sun.com/developer/technicalArticles/J2SE/locale/

Look for "This list is quite short: English (U.S.)."

If we wanted to make it bullet-proof, we could either switch to the
default locale completely, but that changes behaviour quite a lot as you
noticed, or use DateFormatSymbols to just fix the month names. That
would be the old behaviour with inconsistent formatting.

I suggest we use en_US if available, otherwise the default locale. In
any case make it overwritable by an attribute. That would give
consistent behaviour, which on most installations should be as good or
even better than before.

Regards,

Rainer


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


Re: svn commit: r1144833 - in /tomcat/trunk: java/org/apache/catalina/valves/AccessLogValve.java webapps/docs/changelog.xml

Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/7/10  <rj...@apache.org>:
> Author: rjung
> Date: Sun Jul 10 11:22:40 2011
> New Revision: 1144833
>
> URL: http://svn.apache.org/viewvc?rev=1144833&view=rev
> Log:
> Another regression in 7.0.18: year number formatting
> in AccessLogValve is broken due to type "yyy" instead of "yyyy".
>

Nice catch.

There is one more regression there:  month names are now localized
and may be printed not in English, but in other languages.

127.0.0.1 - - [09/июл/11:00:48:22 +0400] "GET /examples/ HTTP/1.1" 200 1156




Best regards,
Konstantin Kolinko


> Modified:
>    tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java
>    tomcat/trunk/webapps/docs/changelog.xml
>
> Modified: tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java?rev=1144833&r1=1144832&r2=1144833&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/valves/AccessLogValve.java Sun Jul 10 11:22:40 2011
> @@ -263,7 +263,7 @@ public class AccessLogValve extends Valv
>         private class Cache {
>
>             /* CLF log format */
> -            private static final String cLFFormat = "dd/MMM/yyy:HH:mm:ss";
> +            private static final String cLFFormat = "dd/MMM/yyyy:HH:mm:ss";
>
>             /* Second used to retrieve CLF format in most recent invocation */
>             private long previousSeconds = 0L;
>
> Modified: tomcat/trunk/webapps/docs/changelog.xml
> URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1144833&r1=1144832&r2=1144833&view=diff
> ==============================================================================
> --- tomcat/trunk/webapps/docs/changelog.xml (original)
> +++ tomcat/trunk/webapps/docs/changelog.xml Sun Jul 10 11:22:40 2011
> @@ -71,6 +71,9 @@
>       <add>
>         Add option to activate AccessLog for unit tests. (rjung)
>       </add>
> +      <fix>
> +        Fix regression in year number formatting for AccessLogValve. (rjung)
> +      </fix>
>     </changelog>
>   </subsection>
>   <subsection name="Cluster">
>

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