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

appender: add filter to limit and rotate log files by size #3026

Closed
wants to merge 1 commit into from
Closed

appender: add filter to limit and rotate log files by size #3026

wants to merge 1 commit into from

Conversation

adrianbenavides
Copy link

@adrianbenavides adrianbenavides commented Jul 7, 2024

EDIT: after reviewing #2497 in detail I decided to close this one. That PR has more or less what I expected from this feature, so I'll close this one to focus the attention on that PR. Apologies for the noise.

Motivation

The RollingFileAppender currently allows you to rotate the log files by time and limit the number of previous files kept on disk. In some environments where the disk capacity is limited, we also need to control and limit the size of the logs.

So far, two PR's have been submitted to add this feature: #2904 and #2497. Both try to add a new Rotation variant, forcing the user to choose between rotating by time or size, which can limit the UX depending on the needs of the user.

What I'd like ideally is to rotate logs on a frequency basis, but also limit the max size of a log file. The main goal though can be achieved with any of the 3 open PR's, which is having the ability to determine the max size of the logs of an application to get a better estimate of the host machine's disk requirements.

Closes #1940
Closes #858

Solution

This PR adds a new filter to limit the size of the logs files, which can be used together with the frequency rotation filter. The first condition to be met will decide how the file is rotated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow tracing-appender sized log and rotation RotatingFileAppender
1 participant