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

Create the file when the file does not exist #131

Open
wants to merge 1 commit into
base: v2.0
Choose a base branch
from
Open

Create the file when the file does not exist #131

wants to merge 1 commit into from

Conversation

njuptlzf
Copy link

I realized Lumberjack in the audit module of Kubernetes.

When the file is deleted, it needs to be recreated without restarting the process to ensure that the log is not lost.

@njuptlzf
Copy link
Author

PTAL @natefinch

@natefinch
Copy link
Owner

I don't really want to incur the overhead of doing an os.stat on every single write.

A better way to do this is to handle the error when you try to write to a file that's been deleted. They way the only overhead is when the file is actually missing.

@njuptlzf
Copy link
Author

I don't really want to incur the overhead of doing an os.stat on every single write.

A better way to do this is to handle the error when you try to write to a file that's been deleted. They way the only overhead is when the file is actually missing.
This sounds correct.
I noticed that many log libraries do not have this kind of log file loss judgment. Can you share your opinion on this?
For the time being I only think of goroutine, not sure if lumberjack is needed.

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