diff --git a/os/glog/glog_logger_rotate.go b/os/glog/glog_logger_rotate.go index 5a206f351..6e7ca96de 100644 --- a/os/glog/glog_logger_rotate.go +++ b/os/glog/glog_logger_rotate.go @@ -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 }