mirror of
https://gitee.com/johng/gf
synced 2026-07-07 06:15:15 +08:00
Revert "Use Copyfile() to back up the log, so as not to continue writing the log to the old file because the old fd is not closed #1366"
This reverts commit a3bab8db55.
This commit is contained in:
@ -100,13 +100,9 @@ func (l *Logger) doRotateFile(ctx context.Context, filePath string) error {
|
||||
}
|
||||
}
|
||||
intlog.Printf(ctx, "rotating file by size from %s to %s", filePath, newFilePath)
|
||||
|
||||
if err := gfile.CopyFile(filePath, newFilePath); err != nil {
|
||||
intlog.Error(ctx, "copy file to: ", newFilePath, err)
|
||||
if err := gfile.Rename(filePath, newFilePath); err != nil {
|
||||
return err
|
||||
}
|
||||
gfile.Truncate(filePath, 0)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user