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 Michael Zhou <zy...@alibaba.com> on 2003/01/09 08:07:52 UTC
Can't specify encoding to ConsoleAppender
Hi,
Although ConsoleAppender extends the WriterAppender, it does not follow
the rule of character encoding. Given the source code of
ConsoleAppender:
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));
}
--
Michael Zhou <zy...@alibaba.com>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Can't specify encoding to ConsoleAppender
Posted by Ceki Gülcü <ce...@qos.ch>.
Michael,
Yes, absolutely. One would need to modify the activateOptions mehtod as you
have indicated. I would appreciate if you could file a bug report
reproducing the contents of your message.
At 15:07 09.01.2003 +0800, you wrote:
>Hi,
>
>Although ConsoleAppender extends the WriterAppender, it does not follow
>the rule of character encoding. Given the source code of
>ConsoleAppender:
>
> 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));
> }
>
>--
>Michael Zhou <zy...@alibaba.com>
--
Ceki
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>