springboot日志的滚动如何修改滚动的时间间隔每30秒滚动一次
时间: 2023-05-17 11:03:41 浏览: 102
您可以通过在application.properties文件中添加以下配置来修改Spring Boot日志的滚动时间间隔:
logging.file.max-history=7
logging.file.total-size-cap=10MB
logging.file.clean-history-on-start=true
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
logging.file.name=myapp.log
logging.file.path=/var/log/myapp/
logging.file.max-size=5MB
logging.file.max-index=10
在这个配置中,logging.file.max-history设置了日志文件保留的最大天数,logging.file.total-size-cap设置了日志文件的最大大小,logging.file.clean-history-on-start设置了在启动时是否清除历史日志文件,logging.pattern.console和logging.pattern.file分别设置了控制台和文件日志的输出格式,logging.file.name和logging.file.path分别设置了日志文件的名称和路径,logging.file.max-size和logging.file.max-index分别设置了日志文件的最大大小和最大索引数。您可以根据自己的需求进行修改。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)