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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
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: [hidden email]
          Reporter: [hidden email]
  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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

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

Mark Thomas <[hidden email]> changed:

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

--- Comment #1 from Mark Thomas <[hidden email]> ---
+1

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

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

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=62788

Mark Thomas <[hidden email]> changed:

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

--- Comment #2 from Mark Thomas <[hidden email]> ---
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: [hidden email]
For additional commands, e-mail: [hidden email]