找到logback-spring.xml配置文件,在里面使用如下配置
<!--定义策略日志文件的存储地址-->
<property name="logStrategy.path" value="./logs/strategy"/>
<!-- 按照每天生成日志文件 -->
<appender name="fileStrategy" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<fileNamePattern>${logStrategy.path}/log_strategy.%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!--具体服务的包名-->
<logger name="com.xlkh.strategy" level="DEBUG">
<appender-ref ref="fileStrategy"/>
</logger>
标签:输出,log,MM,dd,yyyy,日志,Logback From: https://www.cnblogs.com/dabu/p/17101772.html