I am trying to output logs with colour codes using Logback and SpringBoot. I am sure this has nothing to do with the two tools I am using. Just an encoding thing.
The format I am using in the pattern is:
%red(%date) %blue(%logger) [%highlight(%-5level)] [%yellow(%method)] [%green(%thread)]%cyan(: %msg%n%throwable)
When I open this in lets say Notepad++ or plain Notepad, all of the colours codes have garbled escape characters like [39m etc. A typical log line looks like this in the file:
[0;39m[31m2022-09-20 14:09:15,895[0;39m [34morg.springframework.beans.factory.support.DefaultListableBeanFactory[0;39m [[39mTRACE[0;39m] [[33mregisterScope[0;39m] [[32mmain[0;39m][36m: Registering scope 'restart' with implementation
In SpringBoot application.yaml I am using:
logging:
charset:
console: UTF-8
file: UTF-8
Is there any way to get rid of this? Or do I have to use any specialised software for this? Would changing the encoding of the file help?
Any pointers would be helpful.