tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34277] New: - Add encoding attribute to Logger element, need UTF-8 log files
Date Sun, 03 Apr 2005 15:04:40 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34277>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34277

           Summary: Add encoding attribute to Logger element, need UTF-8 log
                    files
           Product: Tomcat 5
           Version: Unknown
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: mailmur@yahoo.com


FileLogger always create a platform default encoding for files. Western Windows
usually use ISO1/Cp1252. If webapps use internationalized text such as chinese,
then logfile receives only ? characters.

Univeral solution is to to have UTF-8 written logfiles. Example here with a new
attribute:
<Logger classname="org.apache.catalina.logger.FileLogger"
  directory="logs" prefix="mywebapp_log." suffix=".txt"
  timestamp="true" encoding="UTF-8" />

Additional feature, make UTF-8BOM special case encoding value.
http://koti.mbnet.fi/akini/java/unicodereader/
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058

Due to a bug Java does not support UTF-8 bom marker. This is very unfortunate in
windows world, where all proper text editors add bom mark to the start of
unicode files. Even Notepad does it.

If logger attribute is encoding="UTF-8BOM" then write the following three bytes
to start of _new_ logfile:
byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF };
filestream.write(bom);

This should not create any runtime penalty 'cause a new logfile is created rarely.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message