Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify description of "logging.file.max-history" #17566

Closed
lihongmingming opened this issue Jul 18, 2019 · 8 comments
Closed

Clarify description of "logging.file.max-history" #17566

lihongmingming opened this issue Jul 18, 2019 · 8 comments
Labels
status: superseded An issue that has been superseded by another

Comments

@lihongmingming
Copy link
Contributor

The max-history is the maximum retention days of the log,not number. so i think it will bring ambiguity

@bclozel
Copy link
Member

bclozel commented Jul 18, 2019

The default configuration is rotating files when the size limit is reached and this option is about the maximum number of archive files to keep. The default configuration is not doing daily rollovers.

Even if it did, the official logback documentation is about the maximum number of files and doesn't mention how rotation is configured.

Could you explain what lead you to think that there was a mistake in the docs? Maybe you're experiencing a different problem?

@bclozel bclozel added the status: waiting-for-feedback We need additional information before we can continue label Jul 18, 2019
@lihongmingming
Copy link
Contributor Author

I tested it in my environment. If I set max-history = 3, the logback will clear all logs of three days ago.
So I think this is the number of days to save the file, but it does not refer to the number of logs.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 18, 2019
@bclozel
Copy link
Member

bclozel commented Jul 18, 2019

Could you show your logging options? Did you have other logback configuration files?
Did those log files reach the 10Mb limit?

@bclozel bclozel removed the status: feedback-provided Feedback has been provided label Jul 18, 2019
@spring-projects-issues spring-projects-issues removed the status: waiting-for-feedback We need additional information before we can continue label Jul 18, 2019
@lihongmingming
Copy link
Contributor Author

I only configure it in my bootstrap.yml,did'nt have any other configuration files.

logging:
file:
max-history: 3
max-size: 2KB

@bclozel bclozel changed the title Configuration of Logback:The Discription of max-history is Confusing Clarify description of "logging.file.max-history" Jul 18, 2019
@bclozel
Copy link
Member

bclozel commented Jul 18, 2019

Thanks for the info @lihongmingming !
@wilkinsona and I looked into this and it appears that things can be misleading here.

Spring Boot is using Logback's SizeAndTimeBasedRollingPolicy, which means log files are rotated when the time limit has been reached - also, the log files are split to make sure that files don't exceed the maximum size.

In our case, Spring Boot is using the following pattern %d{yyyy-MM-dd}.%i.gz, which infers daily periods.

This means that, for the following configuration, we might get 14 files if the application logs 20MB every 24hours (2x 10MB files per day):

logging.file.max-history=7
logging.file.max-size=10MB

This holds true, unless developers override the default logback configuration provided by Spring Boot.
I think you're right and we should update the configuration description to reflect that.

Closing in favour of #17567

@bclozel bclozel closed this as completed Jul 18, 2019
@bclozel bclozel added status: superseded An issue that has been superseded by another and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Jul 18, 2019
@bclozel
Copy link
Member

bclozel commented Jul 18, 2019

I'm wondering if we shouldn't add support for total-size-cap Logback property, because currently the total size of archived logs is unbounded. See example in the Logback docs.

@bclozel bclozel added the for: team-attention An issue we'd like other members of the team to review label Jul 18, 2019
@prodingerd
Copy link

prodingerd commented Jul 18, 2019

I'm wondering if we shouldn't add support for total-size-cap Logback property, because currently the total size of archived logs is unbounded. See example in the Logback docs.

Haven't you done this already? See 999780f.

@bclozel bclozel removed the for: team-attention An issue we'd like other members of the team to review label Jul 18, 2019
@bclozel
Copy link
Member

bclozel commented Jul 18, 2019

Right, thanks @prodingerd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another
Projects
None yet
Development

No branches or pull requests

4 participants