Languages
[Edit]
EN

Spring Boot 2 - enable colors in application console (output logs)

6 points
Created by:
LionRanger
461

In this short article, we would liek to show how to enable colors in output logs in Spring Boot 2 application.

Quick solutions:

  1. add spring.output.ansi.enabled=ALWAYS line to application.properties file,
     
  2. add --spring.output.ansi.enabled=ALWAYS option to java command,
    e.g.  java -jar app.jar --spring.output.ansi.enabled=ALWAYS

 

Spring Boot 2 application with enabled colors in output logs.
Spring Boot 2 application with enabled colors in output logs.

Practical example

Edit

Simple steps:

1. open src/main/resources/application.properties file,

2. update the file adding the line:

Note: possible values are: ALWAYSDETECT and NEVER.

 

References

Edit
  1. https://docs.spring.io/spring-boot/docs/2.7.9/api/
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join