Get the App
SLTechnology News&Howtos  ›  Development  › 

How to configure logback-spring.xml for springboot Log

Shulou Source: shulou.com Published: 2022-06-03 08:53:27 11月15日 Update

In this issue, the editor will bring you about how to configure logback-spring.xml for springboot logs. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

1. Add jar package to pom.xml file

Org.springframework.boot

Spring-boot-starter-log4j

1.3.8.RELEASE

Org.slf4j

Slf4j-log4j12

II. Logback-spring.xml configuration

% d {yyyy-MM-dd HH:mm:ss.SSS} [% thread]%-5level% logger {50} -% msg%n

${LOG_HOME} / project_myProject.%d {yyyy-MM-dd}.% i.log

thirty

20MB

% d {yyyy-MM-dd HH:mm:ss.SSS} [% thread]%-5level% logger {50} -% msg%n

After configuration, you can generate logs.

Pay attention to the test: the number of days the log file will be retained (whether the expired file will be automatically deleted) and the maximum file capacity (will another file name suffix 0mem1mem2pyr3 be automatically generated if the capacity is exceeded)

one

1MB

The above is the editor for you to share how to configure logback-spring.xml for springboot logs. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: File log configuration content capacity analysis generation maximum professional small and medium rich content suffix number of days that is file name article more knowledge article automatic generation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi OPPO Reno Xiaomi Shulou Information MariaDB