Hi,
Thanks ;)  We'll keep your author credit of course.

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: Mehmet D. AKIN [mailto:[EMAIL PROTECTED]
>Sent: Thursday, March 18, 2004 9:31 AM
>To: Log4J Users List
>Subject: [SOLUTION] Cosole appender encoding problem (it always uses
>default encoding)
>
>Sure, here it is, I created a new appender, extending default Console
>appender:
>
>TurkishWindowsConsoleAppender.java
>
>/*
> * Created on 18.Mar.2004
> *
> */
>package foo;
>
>import java.io.OutputStreamWriter;
>import java.io.UnsupportedEncodingException;
>
>import org.apache.log4j.ConsoleAppender;
>
>/**
> * @author Mehmet D. AKIN
> *
> */
>public class TurkishWindowsConsoleAppender extends ConsoleAppender {
>    public TurkishWindowsConsoleAppender (){
>        super();
>    }
>
>    public void activateOptions() {
>        if(target.equals(SYSTEM_OUT)) {
>            try {
>                if(Conf.isRunningOnWinConsole)  //<-- make this true to
>use your own windows console encoding
>                    setWriter(new
>OutputStreamWriter(System.out,"CP857")); // <-- Put your own encoding
here
>                else
>                    setWriter(new OutputStreamWriter(System.out));
>            } catch (UnsupportedEncodingException e) {
>                e.printStackTrace();
>            }
>        } else {
>            setWriter(new OutputStreamWriter(System.err));
>        }
>    }
>}
>
>and change your Logger configuration file as:
>
>log4j.rootCategory=DEBUG, cons
>log4j.appender.cons=foo.TurkishWindowsConsoleAppender
>
>Hope it helps
>
>Mehmet.
>
>
>
>
>Shapira, Yoav wrote:
>
>>Hi,
>>Would you care to donate your enhancement to the log4j project?  We'd
be
>>grateful ;)
>>
>>Yoav Shapira
>>Millennium Research Informatics
>>
>>
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to