Open njuptlzf opened 3 years ago
PTAL @natefinch
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.
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.
I realized Lumberjack in the
audit
module ofKubernetes
.When the file is deleted, it needs to be recreated
without restarting the process
to ensure that the log is not lost.