logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 52014] New: option to set encoding for console appender conflicts with Java option -Dfile.encoding
Date Wed, 12 Oct 2011 17:24:02 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=52014

             Bug #: 52014
           Summary: option to set encoding for console appender conflicts
                    with Java option -Dfile.encoding
           Product: Log4j
           Version: 1.2
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: jukefox@web.de
    Classification: Unclassified


The option to set encoding for console appender conflicts with Java option
-Dfile.encoding.
The reason for my opinion is that I found that the ConsoleAppender-class does
not honor the encoding of the System.out- / System.err-PrintStream-class which
might differ from the ConsoleAppender setting. That is because you bypass the
print-methods of the PrintStream-instance by using its write-methods.
This leads to an erroneous situation as soon as a program uses both of the two
mechanisms to write something to the console: On the one hand by using a
log4j-Logger-instance and on the other side by using System.out / System.err
and its print-methods.
The System-classes print-methods will use the encoding specified with
-Dfile.encoding whereas the log4j-mechanism will use its own encoding.
Finally both write to the same destination (the console) with potentially
different encodings.

I really cannot think of any scenario, where I should ever use the
encoding-setting for the console appender or am I missing something?
It only works safe when one ensures that the System-classes print-methods are
never used within the program.
As a consequence I think that the enconding option is superfluous for the
ConsoleAppender and its implementation which has been done with #15942 should
be undone. Use -Dfile.encoding instead!

Any comments on this are welcome.

Thanks.

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

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


Mime
View raw message