Log color in Spring Boot

Nilesh Parab
3 minute Written by Nilesh Parab on
Log color in Spring Boot Photo by Toni Reed on Unsplash

Yes that’s right! Staring at the bland plain logs is monotonous & cumbersome. It was & is painful to always figure out the warnings & errors out of logs.

Plain Console

While in Oracle Commerce (ATG) we used to have a special program the LogColorizer to color the console output making it easy for us to figure out error (colored red) & warnings (colored yellow).

:rainbow: Way to colors

Now with Spring I started missing it until I discovered that in their documentation.
Just follow these 2 steps:

  • In your application.properties add below configuration:
      # default value is DETECT
      spring.output.ansi.enabled=ALWAYS
    
  • In your terminal set the environment variable to enable ANSI output:
      export CLICOLOR=1
    

Now start you application to see the new look:

Colored Console

That’s all. Thanks. Please feel free suggest me any edits or help you need.

Nilesh Parab
About Nilesh Parab I love building things using Java & JavaScript. Professionally I am more focussed in eCommerce. Music. Motorcycling.