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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to