Reputation: 41
My spring-boot application keeps archive logs for only 7 days as defined in the defaults as defined in the logging defaults.
The issue is that I need these logs to always be there and never be deleted.
Is there a way to specify this?
sample Config
logging:
file:
name: logs/application.log
file.max-size: 200MB
level:
org.apache.http: INFO
org.springframework.cloud.sleuth: INFO
org.springframework.web: INFO
Upvotes: 0
Views: 1742
Reputation: 352
According to the logback documentation, setting maxHistory to zero disables archive removal and setting totalSizeCap to zero disables archive removal by combined size threshold. However, it is mentioned that "The totalSizeCap property requires maxHistory property to be set as well". The maxHistory of default FileAppender in Spring Boot is 7 by default. So, setting
logging.logback.rollingpolicy.max-history=0
in your application properties might do the trick.
logging:
logback:
rollingpolicy:
max-file-size: 0
file:
name: logs/application.log
max-size: 200MB
level:
org:
apache:
http: INFO
springframework:
cloud:
sleuth: INFO
web: INFO
Upvotes: 3