You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2018/10/01 22:24:38 UTC

[Bug 62788] New: Add explicit ".encoding=UTF-8" to FileHandler configurations in logging.properties

https://bz.apache.org/bugzilla/show_bug.cgi?id=62788

            Bug ID: 62788
           Summary: Add explicit ".encoding=UTF-8" to FileHandler
                    configurations in logging.properties
           Product: Tomcat 9
           Version: 9.0.12
          Hardware: PC
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: knst.kolinko@gmail.com
  Target Milestone: -----

This is inspired by a StackOverflow question [1].

While most of Tomcat 8.5/9.0 uses UTF-8 by default, the default configuration
of (Async)FileHandlers in logging.properties is to use the system default
character set.

1. There is no configuration for the "encoding" property of those FileHandlers
in the default 'logging.properties' file.

2. The default value for that property is to use the system default character
set. As documented in javadoc [2].


I find this odd.

My proposal is to add explicit configuration for the 'encoding' property of
AsyncFileHandlers in Tomcat 9.0.x onwards to be 'UTF-8':

1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-8

etc.


I think that for a ConsoleHandler [3] it is expected to use the system
encoding. It is used for monitoring at development time, and should not be used
on a production system.

I think that a file written by a FileHandler is expected to preserve all
information written to it, and UTF-8 suits better for this purpose.


[1]
https://stackoverflow.com/questions/52591511/how-to-set-character-encoding-to-servletcontext-logs-in-tomcat

[2]
http://tomcat.apache.org/tomcat-9.0-doc/api/org/apache/juli/FileHandler.html

[3]
https://docs.oracle.com/javase/6/docs/api/java/util/logging/ConsoleHandler.html

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62788] Add explicit ".encoding=UTF-8" to FileHandler configurations in logging.properties

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62788

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Fixed in:
- trunk for 9.0.14 onwards
- 8.5.x for 8.5.36 onwards
- 7.0.x for 7.0.92 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62788] Add explicit ".encoding=UTF-8" to FileHandler configurations in logging.properties

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62788

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
+1

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org