|Summary:||Tomcat access log doesn't support Unicode|
|Product:||Tomcat 5||Reporter:||Adam <adam_polomski>|
|Component:||Catalina||Assignee:||Tomcat Developers Mailing List <dev>|
Description Adam 2008-11-20 11:18:55 UTC
AccessLogValve, which is responsible for handling the access log uses FileWriter (that doesn't support Unicode). I guess that instantiating the writer like this would solve the case: writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(pathname), "UTF-8"), true);
Comment 1 Mark Thomas 2009-04-16 14:38:59 UTC
I am curious as to which elements you are trying to log that require UTF-8. Most will be ISO-8859-1. The only exceptions I can think of are user name and session attribute values. I am concerned that whilst an access log is typically configured at the host level the user name encoding can vary from request to request (if you are using FORM) and session attributes are under no obligation to use a single consistent encoding. Therefore, it would be rather difficult to ensure the correct logging of each of these elements. Given the above I am not in favour of using UTF-8 by default. However, I can see the potential of making the encoding configurable with the default being the current behaviour. Therefore, I am marking this as an enhancement. Patches are always very welcome and if you are interested in writing such a patch and need any assistance feel free to ask on the dev list.
Comment 2 Konstantin Kolinko 2011-07-11 15:16:40 UTC
Implemented in 7.0 with r11145200 and will be in 7.0.19.
Comment 3 Konstantin Kolinko 2011-07-11 16:01:05 UTC
Created attachment 27278 [details] 2011-07-11_tc6_bug46252.patch Correction: that revision number above was r1145200 Here is patch that will be proposed for Tomcat 6. Backport to Tomcat 5.5 is unlikely.
Comment 4 Konstantin Kolinko 2011-07-11 17:03:05 UTC
Created attachment 27279 [details] 2011-07-11_tc6_bug46252_v2.patch Updated patch: added r1145237 This adds in AccessLogValve: - i18n for messages - Log a failure if access log file cannot be opened. - Autocreate directory if it is specified as a part of the file name in FileHandler: - Autocreate directory if it is specified as a part of the file name
Comment 5 Konstantin Kolinko 2011-07-11 18:17:32 UTC
Created attachment 27280 [details] 2011-07-11_tc6_bug46252_JMX.patch Additional patch: Expose the new "encoding" option through JMX. I also fixed wrong mapping for "getEnabled()".