Spring Boot中整合slf4j+logback

在新建的maven Spring Boot项目的pom.xml加入依赖


org.springframework.boot
spring-boot-starter

然后配置application.properties

#logging.config=classpath:log4j2.xml
#日志相关配置
logging.level.root=INFO
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=ERROR
logging.path=/Users/xiaweiyi/Downloads/demo/logs
#logging.file=demo.log
image.png
image.png

Logback.xml详细代码:






%d{HH:mm:ss.SSS}[%thread]%-5level%logger{35}-%msg%n
UTF-8



/Users/xiaweiyi/Downloads/demo/logs/stdout.log


/Users/xiaweiyi/Downloads/demo/logs/stdout.log.%d{yyyy-MM-dd}.log

30


10MB


%d{HH:mm:ss.SSS}[%thread]%-5level%logger{35}-%msg%n
UTF-8







你可能感兴趣的:(Spring Boot中整合slf4j+logback)