Open curd0 opened 8 months ago
I have the same problem. Would be great if someone would look at this issue.
@curd0 Thank you for this report.
Testing on "Windows 11 Home" and Java 21, it all looks good. Which version of Windows and Java are you testing with?
Hello @ceki, the problem was originally reported on Windows 2019 Server, but I could also reproduce it on my development Windows 11 Enterprise machine:
The version of Java doesn't seem relevant, I'm getting the same output with Java 11, 17, and 21.
Please note, that the problem is only reproducible in old CMD.EXE console. If you have Windows Terminal installed on your machine, then, by default, when you try to start CMD.EXE Windows starts Windows Terminal instead.
To change that default (you can reverse it later) pick "Windows Console Host" as a default terminal application in Windows Terminal Settings:
@curd0 Thank you. I can reproduce the problem.
ConsoleAppender does not invoke AnsiConsole.systemInstall() which seems to make difference. Under Windows, in Jansi 1.x it seems to work regardless but not in Jansi 2.x.
On Windows, when I use
logback 1.4.14
withJansi 2.4.0
in the old CMD.EXE console, the logback fails to produce color-coded output. The same code executed in Windows Terminal works as expected.Interestingly, substituting the current
Jansi 2.4.0
with an olderJansi 1.18
, seems to fix the issue. This suggests that there might be some differences in the newer versions of Jansi that Logback doesn't handle very well.The following ZIP contains a simple example (requires Java 11+) that produces colored output using standalone
Jansi 1.18
and2.4.0
, and Logback withJansi 1.18
and2.4.0
. To execute: extract and runjansi-examples.bat
jansi-examples.zip
Here's the output produced on the same machine in CMD.EXE console:
and in Windows Terminal: