You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Mehmet D. AKIN" <md...@uekae.tubitak.gov.tr> on 2004/03/18 10:22:48 UTC

Cosole appender encoding problem (it always uses default encoding)

Hi,
Windows uses Cp-857 (Turkish) for console text encoding to display 
turkish characters, but log4j console appender forces its writer to use 
default encoding (windows-1254 Turkish)  so I see tons of garbage in 
windows console for log4j's output.

Changing System.out's encoding to Cp-857 causes System.out.println() 
calls to write in correct encoding to console  but logger still refuses 
to write as we tracked the source code Log4j first assigns System.out to 
an stream writer like (in consoleAppender.java, activateOptions method, 
line 86):

setWriter(OutpuStreamWriter(System.out))

and java assigns "default encoding" for OutputStreamWriter if this 
constructor is used, I suggest other constructor with "CharsetName" 
should also be used.

is there a workaround for this problem, is there a way to tell Console 
appender use an encoding other than the default ?

thanks in advance.

Mehmet.



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


[SOLVED] Cosole appender encoding problem (it always uses default encoding)

Posted by "Mehmet D. AKIN" <md...@uekae.tubitak.gov.tr>.
We supplied our own appender which extends consoleappender and problem 
is solved.



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