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

Prevent rolling file appender panic #5117

Merged

Conversation

eserilev
Copy link
Collaborator

@eserilev eserilev commented Jan 23, 2024

Issue Addressed

#5116

Proposed Changes

tracing_appender::rolling::daily can cause panics. This PR uses the RollingFIleAppender:Builder() instead, which returns a Result and allows us to gracefully handle errors.

On a separate note, while playing around with the builder, I noticed a max_log_file option

https://docs.rs/tracing-appender/latest/tracing_appender/rolling/struct.Builder.html#method.max_log_files

This allowed me to delete the cleanup_logging_task which should simplify things a bit

Additional notes

This still doesn't resolve the underlying issue in #5116, it just prevents the panic

Copy link
Member

@AgeManning AgeManning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah nice.

I really hated that cleanup task. I'm glad there was a reasonable solution. I didn't see that max log files function on an initial pass. Thanks!

@AgeManning AgeManning merged commit 612eaf2 into sigp:unstable Jan 23, 2024
28 checks passed
danielramirezch pushed a commit to danielramirezch/lighthouse that referenced this pull request Feb 14, 2024
* rolling file appender panic removal and max log file count

* max log file
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.

2 participants