Unfortunately it turns out that Console.charset() was only introduced in Java 17, and the PrintStream.charset() method which would deal with this directly was not available until Java 18. Additionally System.err doesn't even follow its own API; if stdout is redirected, there seems to be no way to find the charset used by System.err. (See long discussion on Stack Overflow.) Nevertheless the current approach used by Logback is broken. Something has to be done, or admit that the entire logging Logback core can't even use the correct charset and that it won't be fixed. Some console class appender that delegates to the PrintStream.print() methods is probably the only option until Java 18. |