logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Generating Log files with specified File Encoding type- UTF8, Latin 1
Date Fri, 27 May 2005 13:54:28 GMT
Try using "UTF-8".  The encoding gets passed down to the Java class  
library which supports at a minimum the 6 encoding names listed at  
Charset.html,  If you go off this list, you are depending on  
implementation or platform specific features.

I recently added a test to the CVS HEAD tests/src/java/org/apache/ 
log4j/EncodingTest.java to check encoding specifications.  You will  
need to use a test string containing non US-ASCII characters if you  
want to see the effects of encoding specifications, "asdfd..." won't  
show anything.

On May 27, 2005, at 7:12 AM, Ramkumar Polakulath wrote:

> Hi,
> Can any one provide a sample code on how to generate log files on  
> specified encoding format(UTF8,latin1 etc).
> I use the following, but doesn't seems to be working out exactly.  
> Or to be more precise can any one pls verify the below code for its  
> correctness-
> ---------------------------------------------UTF8  
> Encoding-----------------------------
> private static Logger transaction = Logger.getLogger 
> ("TransactionLogger");
> FileAppender fileTransactionAppender = new FileAppender(new  
> PatternLayout("%m\n"),"sample.txt",true);
>    fileTransactionAppender.setEncoding("UTF8");
>    fileTransactionAppender.activateOptions();
>    transaction.addAppender(fileTransactionAppender);
>    transaction.setLevel(Level.toLevel(2));
> transaction.debug("asdfdsfdsfds");
> ---------------------------------------------------------------------- 
> ------------------------

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message