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 Thierry Sourbier <ml...@i18nGurus.com> on 2003/01/07 03:50:14 UTC
i18n & FileAppender...
Hello,
It looks like the FileAppender currently limits its ouput to the default
system file encoding. This is when you are trying to debug a program using
Japanese data on a US system, as all Japanese characters are reduced to
question marks [?] :(. This is an unecessary restriction.
Calling WriterAppender.setEncoding() method has no effect on the behavior of
the FileAppender since the OutputStreamWriter has already been created when
at construction time.
A temporary solution if I may suggest one would be to add one constructor to
the FileAppender that would take an extra encoding argument e.g:
public FileAppender(Layout layout, String filename, boolean append, boolean
bufferedIO,
int bufferSize, String encoding) throws IOException {
this.layout = layout;
this.setEncoding(encoding);
this.setFile(filename, append, bufferedIO, bufferSize);
}
That would enable user to have log file in any encoding they chose to.
Cheers,
Thierry.
http://www.i18ngurus.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: i18n & FileAppender...
Posted by Thierry Sourbier <ml...@i18nGurus.com>.
It sure does.
Thanks for the hint!
Thierry.
-----Message d'origine-----
De : Ceki Gulcu [mailto:ceki@qos.ch]
Envoye : mardi 7 janvier 2003 05:22
A : Log4J Developers List
Objet : Re: i18n & FileAppender...
Try
FileAppender fa = new FileAppender();
fa.setFile("xyz");
fa.setLayout(new PatternLayout());
fa.setEncoding(yourEncoding);
.. set other options
fa.activateOptions();
Hope this helps,
At 03:50 07.01.2003 +0100, you wrote:
>Hello,
>
>It looks like the FileAppender currently limits its ouput to the default
>system file encoding. This is when you are trying to debug a program using
>Japanese data on a US system, as all Japanese characters are reduced to
>question marks [?] :(. This is an unecessary restriction.
>
>Calling WriterAppender.setEncoding() method has no effect on the behavior
of
>the FileAppender since the OutputStreamWriter has already been created when
>at construction time.
>
>A temporary solution if I may suggest one would be to add one constructor
to
>the FileAppender that would take an extra encoding argument e.g:
>
>public FileAppender(Layout layout, String filename, boolean append, boolean
>bufferedIO,
> int bufferSize, String encoding) throws IOException {
> this.layout = layout;
> this.setEncoding(encoding);
> this.setFile(filename, append, bufferedIO, bufferSize);
>}
>
>That would enable user to have log file in any encoding they chose to.
>
>
>Cheers,
>
>Thierry.
--
Ceki
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: i18n & FileAppender...
Posted by Ceki Gülcü <ce...@qos.ch>.
Try
FileAppender fa = new FileAppender();
fa.setFile("xyz");
fa.setLayout(new PatternLayout());
fa.setEncoding(yourEncoding);
.. set other options
fa.activateOptions();
Hope this helps,
At 03:50 07.01.2003 +0100, you wrote:
>Hello,
>
>It looks like the FileAppender currently limits its ouput to the default
>system file encoding. This is when you are trying to debug a program using
>Japanese data on a US system, as all Japanese characters are reduced to
>question marks [?] :(. This is an unecessary restriction.
>
>Calling WriterAppender.setEncoding() method has no effect on the behavior of
>the FileAppender since the OutputStreamWriter has already been created when
>at construction time.
>
>A temporary solution if I may suggest one would be to add one constructor to
>the FileAppender that would take an extra encoding argument e.g:
>
>public FileAppender(Layout layout, String filename, boolean append, boolean
>bufferedIO,
> int bufferSize, String encoding) throws IOException {
> this.layout = layout;
> this.setEncoding(encoding);
> this.setFile(filename, append, bufferedIO, bufferSize);
>}
>
>That would enable user to have log file in any encoding they chose to.
>
>
>Cheers,
>
>Thierry.
--
Ceki
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>