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

Size rolling #2904

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Size rolling #2904

wants to merge 3 commits into from

Conversation

x3ccd4828
Copy link

This patch adds size-based rotation to tracing-appender.

Closes #1940
Closes #858

cc @hawkw @IniterWorker @CfirTsabari @davidbarsky @CBenoit

There is another pull request (#2497) for this feature but I thought I would try a different approach.

Motivation

In a constrained environment, we should be able to constrain the logging size and period.

Solution

Maximum bytes per log file may be specified in the max_file_size function when building the appender. The option will only be used when selecting Rotation::SIZE.

File size is checked every write and if the size is exceeded the log file is rolled over.

None of the other rotation types use sub-seconds in the logfile name but for size-based rotation, I used it since there could be a plethora of writes in a short period and this was the simple way to ensure filename uniqueness otherwise it would write to the same file even if the size was exceeded. This is a limitation since I tried to use the same methodology as the time-based rolling without rewriting the architecture.

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