现有web系统替换成Spring Boot2框架 之4 日志框架 Spring Boot日志logback
spring-boot-starter集成了日志组件,支持Java Util Logging, Log4J2, Logback,使用哪个日志框架,在resources目录下添加响应的配置文件即可(logging.properties/log4j2-spring.xml/logback-spring.xml),这里以logback为例,增加logback-spring.xml文件,添加如下配置:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration scan="true" scanPeriod="60 seconds">
<appender name="smallbss" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/smallbss.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>logs/bat/boss.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
<totalSizeCap>3GB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>%d %-5level [%thread] %logger [line:%line]- %msg%n</pattern>
</encoder>
</appender>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d %-5level %logger [line:%line]- %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="smallbss" />
<appender-ref ref="console" />
</root>
</configuration>
推荐阅读
-
现有web系统替换成Spring Boot2框架 之20 启动报错处理 spring boot启动报错@SpringBootApplicationUnable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
-
现有web系统替换成Spring Boot2框架 之17 设置项目访问端口 spring boot端口
-
现有web系统替换成Spring Boot2框架 之20 启动报错处理 spring boot启动报错@SpringBootApplicationUnable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
-
现有web系统替换成Spring Boot2框架 之21 同时支持带项目名和不带项目名访问,web访问强制https,接口保持http访问 Spring Boot2带项目名不带项目名httpshttp
-
现有web系统替换成Spring Boot2框架 之7 拦截器 spring bootmaven拦截器addInterceptors
-
现有web系统替换成Spring Boot2框架 之10 定时任务Quartz Scheduler spring bootmaven定时任务quartz
-
现有web系统替换成Spring Boot2框架 之14 I18n国际化实现 spring bootmaveni18国际化
-
现有web系统替换成Spring Boot2框架 之4 日志框架 Spring Boot日志logback
-
现有web系统替换成Spring Boot2框架 之21 同时支持带项目名和不带项目名访问,web访问强制https,接口保持http访问 Spring Boot2带项目名不带项目名httpshttp