Return to site

๐Ÿƒ๐ŸŽ“ SPRING CERTIFICATION QUESTION: How can you control logging with Spring Boot?

ยท spring,vcp

Answer:

Even though Spring Boot is an 'opinionated' framework, its true power comes with the possibility to customize each and every pre-configured layer.

When it comes to logging the following can be changed:

* log level of the core Spring loggers (container, Hibernate, Spring Boot):

--> specify --๐’…๐’†๐’ƒ๐’–๐’ˆ or --๐’•๐’“๐’‚๐’„๐’† flag.

--> specify application property ๐’…๐’†๐’ƒ๐’–๐’ˆ=๐’•๐’“๐’–๐’†, ๐’•๐’“๐’‚๐’„๐’†=๐’•๐’“๐’–๐’†.

* message color of console output.

* file output using ๐’๐’๐’ˆ๐’ˆ๐’Š๐’๐’ˆ.๐’‡๐’Š๐’๐’† or ๐’๐’๐’ˆ๐’ˆ๐’Š๐’๐’ˆ.๐’‘๐’‚๐’•๐’‰ application property.

* logging level of specific classes or logging groups.

* specify different logging implementations by including libraries on the classpath (logback is used by default).

#spring #certificationquestion #vcp

Logging in Spring Boot ๐Ÿ‘‰ https://www.baeldung.com/spring-boot-logging