[
https://issues.apache.org/jira/browse/LOG4J2-1636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15561440#comment-15561440
]
Eldar Gabdullin edited comment on LOG4J2-1636 at 10/10/16 6:28 AM:
-------------------------------------------------------------------
We use Java 8 and in Java 8 {{System.out}} is a {{PrintWriter}} with encoding
from system property {{sun.stdout.encoding}} which differs from
{{Charset.defaultCharset()}}.
{code}
System.getProperty("sun.stdout.encoding")); // cp866
Charset.defaultCharset(); // windows-1251
System.out.write("Поехали\n".getBytes(System.getProperty("sun.stdout.encoding")));
// Works !
{code}
was (Author: eldargab):
We use Java 8 and in Java 8 {{System.out}} is a {{PrintWriter}} with encoding
from system property {{sun.stdout.encoding}} which differs from
{{Charset.defaultCharset()}}.
{{code}}
System.getProperty("sun.stdout.encoding")); // cp866
Charset.defaultCharset(); // windows-1251
System.out.write("Поехали\n".getBytes(System.getProperty("sun.stdout.encoding")));
// Works !
{{code}}
> Bad console output encoding on windows
> --------------------------------------
>
> Key: LOG4J2-1636
> URL: https://issues.apache.org/jira/browse/LOG4J2-1636
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders, Layouts
> Environment: Windows
> Reporter: Eldar Gabdullin
>
> Default log4j configuration prints to console using platform's default
> encoding, however that's not what standard windows console expects.
> I.e.
> {code}
> System.out.println("Поехали"); // works just fine
> System.out.write("Поехали!\n".getBytes(Charset.defaultCharset())); //
> characters are messed up
> log.info("Поехали"); // messed up in the same way
> {code}
> This happens not just on one machine, but on all Windows desktops and servers
> in our organization.
> Can we have out of the box Layout/Appender which prints directly to
> System.out/err?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]