SpringBoot in default logging implementation slf4j

This article is a tutorial notes:
https://www.springboottutorial.com/logging-with-spring-boot-logback-slf4j-and-log4j
I have a simple SpringBoot application, its dependencies in pom.xml It is defined as follows:

FIG see a lot of the Starter, such as Spring-boot-starter-data-redis, Spring-boot-starter-web like. The Starter contains a spring-boot-starter, and the starter and the starter contains an implementation logging, called spring-boot-starter-logging.

That is, if we use SpringBoot, no longer need to import additional configuration, you can use the log function.

SpringBoot slf4j default implementation is logback, is the default output to the console console:

As you can see the default logging framework is Logback with SLF4j as implementation.
By default, all logging goes to console.

Use logging.level.root log level configuration items in the global Application.properties file:

Of course, to carry out the logging level are configured for individual packages is also possible:
logging.level.some.package.path = DEBUG
logging.level.some.other.package.path = ERROR

Custom configuration using logback.xml

Spring Boot will pick up all custom configuration using logback.xml as long as it is in the application class path.

将日志写入本地日志文件的做法:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

发布了6590 篇原创文章 · 获赞 634 · 访问量 107万+

Guess you like

Origin blog.csdn.net/i042416/article/details/104245515