You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2003/01/10 03:07:53 UTC

DO NOT REPLY [Bug 15942] New: - Can't specify encoding to ConsoleAppender

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15942>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15942

Can't specify encoding to ConsoleAppender

           Summary: Can't specify encoding to ConsoleAppender
           Product: Log4j
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Appender
        AssignedTo: log4j-dev@jakarta.apache.org
        ReportedBy: zyh@alibaba.com


Although ConsoleAppender extends the WriterAppender, it does not follow
the rule of character encoding.  Given the source code of
ConsoleAppender: (of constructor and method activateOptions)

    if(target.equals(SYSTEM_OUT)) {
      setWriter(new OutputStreamWriter(System.out));
    } else {
      setWriter(new OutputStreamWriter(System.err));
    }

If I want to output characters other than the system default character
set, the ConsoleAppender outputs "?".  Is it better modify the code as
below?

    if(target.equals(SYSTEM_OUT)) {
      setWriter(createWriter(System.out));
    } else {
      setWriter(createWriter(System.err));
    }

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>