If you change static Logger logger = Logger.getLogger(Sort.class.getName()); to static Logger logger = Logger.getRootLogger(); you will see 'setEncoding called.' in the console.
-----Original Message----- From: KUROSAKA Teruhiko [mailto:[EMAIL PROTECTED] Sent: 2003年10月30日 15:36 To: [EMAIL PROTECTED] Subject: How do I set the character encoding ? Hello, I am new to the list, and to log4j. It seems that log4j writes log in the encoding specified by file.encoding property. Is there a way to override this? I would like to write my log files in UTF-8 encoding regardless of the platform's locale setting. Experimenting with Sort.java sample program, I thought this would work: static Logger logger = Logger.getLogger(Sort.class.getName()); .... Enumeration appenders=logger.getAllAppenders(); if(appenders!=null){ if(!appenders.hasMoreElements()){ System.out.println("getAllAppender() returned zero-count Enuml.\n"); }else{ while(appenders.hasMoreElements()){ Object o=appenders.nextElement(); if (o instanceof WriterAppender){ ((WriterAppender)o).setEncoding("UTF-8"); System.out.println("setEncoding called.\n"); } } } }else{ System.out.println("getAllAppender() returned null.\n"); } But it doesn't because getAllAppenders() returns the NullEnumerator. I am actually hoping that this can be done in configuration, like: log4j.appender.R.encoding=UTF-8 Is there such luck ? KUROSAKA "Kuro" Teruhiko --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]