'In the Eclipse IDE console, how can the text output be copied without escape code characters
In the Eclipse IDE, running on the Windows platform, I will often copy some or all of the console output to a text editor when debugging my code. Unfortuantely the resulting text is full of escape characters and special codes. It makes the information much more difficult to read. None of it visibly appears in Eclipse's actual console.
I have long been annoyed by how Eclipse handles the format of the text that is copied. Is this a default behavior that can be modified to copy output without the special codes and escape characters? Ideally I would like to copy the raw text with just the basic Line Feed, new line, and end of line control characters.
Also, I should note that I am using the "Spring Tool Suite" (STS) customized release, so there is a small chance that my experience would differ if using the base Eclipse IDE... but I expect that it is inherent to Eclipse itself.
Example of the console output, as it appears in Eclipse:
2018-10-24T09:00:41.902-06:00 INFO 45304 --- [enerContainer-2] o.l.p.c.s.i.MyServiceIntegration : writeContact contacts="1" timeMS="22"
2018-10-24T09:00:41.903-06:00 WARN 45304 --- [enerContainer-1] org.zzz.logging.LogService : Error getting RequestInfo data. nested exception is ..."
2018-10-24T09:00:41.904-06:00 INFO 45304 --- [enerContainer-1] o.l.p.c.s.listener : Processing contacts from Message ID: zlt223247 [contact.number.init]
How it looks when copied into a text editor (I've tried multiple)
2m2018-10-24T09:00:41.902-06:00ESC[0;39m [32m INFO[0;39m [35m45304[0;39m [2m---[0;39m [2m[enerContainer-2][0;39m [36mo.l.p.c.s.i.MyServiceIntegration [0;39m [2m:[0;39m writeCtags tags="1" timeMS="22"
2m2018-10-24T09:00:41.903-06:00ESC[0;39m [33m WARN[0;39m [35m45304[0;39m [2m---[0;39m [2m[enerContainer-1][0;39m [36morg.zzz.logging.LogService [0;39m [2m:[0;39m Error getting RequestInfo data. nested exception is..."
2m2018-10-24T09:00:41.904-06:00ESC[0;39m [32m INFO[0;39m [35m45304[0;39m [2m---[0;39m [2m[enerContainer-1][0;39m [36mo.l.p.c.s.listener
If you scroll left and right, you can see how garbled the "copied" console appears in your standard text editor. If anyone knows how to copy a "clean" copy of the output, I would love to know how!
Solution 1:[1]
I had the same problem. I have found several solutions to the issue:
Here is the documentation from Spring on this issue - https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.logging.console-output.color-coded . In theory, colors can be disabled with the spring.output.ansi.enabled=never option. However, for some reason it didn't work for me.
You can use the plugin for Eclipse - "ANSI Escape in Console". It works fine, but there is one problem - it slows down the console.
I found it by accident. It looks like the spring.output.ansi.enabled parameter is set to "DETECT" by default, i.e. if Spring Boot finds that the console supports "ANSI escape characters", then it will output them to the console. This parameter for the Eclipse console can be found in "Run -> Run configurations...". We find the configuration we need and uncheck "ANSI console output" on the "Spring Boot" tab.

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vorburger |


