diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index d127f27ed..33d8d89c0 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -492,17 +492,17 @@ func getLastLogFromModelDir(jobName string, lines int) map[string]interface{} { fileName = file.FileName path := storage.GetMinioPath(jobName+"/model/", file.FileName) allLines = getAllLineFromFile(path) - start := allLines - 50 - if start < 0 { - start = 0 + startLine := allLines - 50 + if startLine < 0 { + startLine = 0 } - count = allLines - start + count = allLines - startLine log.Info("path=" + path) reader, err := os.Open(path) defer reader.Close() if err == nil { r := bufio.NewReader(reader) - for i := start; i < allLines; i++ { + for i := 0; i < allLines; i++ { line, error := r.ReadString('\n') log.Info("line=" + line) if error == io.EOF { @@ -514,7 +514,9 @@ func getLastLogFromModelDir(jobName string, lines int) map[string]interface{} { break } if error == nil { - re = re + line + if i >= startLine { + re = re + line + } } } } else {