1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-02 16:04:26 +00:00

improve log (#498)

* improve log

* write header after internal server error
This commit is contained in:
Xiangyue Cai
2021-09-29 17:08:39 +08:00
committed by GitHub
parent 31c017d2c8
commit c2006c5443
2 changed files with 2 additions and 2 deletions

View File

@@ -390,7 +390,7 @@ func main() {
} }
// When logFile is "-", use default output (StdOut) // When logFile is "-", use default output (StdOut)
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile) log.SetFlags(log.Ldate | log.Ltime)
if absLogFile != "" { if absLogFile != "" {
errorLogFile := filepath.Join(filepath.Dir(absLogFile), "fileserver-error.log") errorLogFile := filepath.Join(filepath.Dir(absLogFile), "fileserver-error.log")

View File

@@ -747,12 +747,12 @@ func getBlockInfo(rsp http.ResponseWriter, r *http.Request) *appError {
blockLen := fmt.Sprintf("%d", blockSize) blockLen := fmt.Sprintf("%d", blockSize)
rsp.Header().Set("Content-Length", blockLen) rsp.Header().Set("Content-Length", blockLen)
rsp.WriteHeader(http.StatusOK)
if err := blockmgr.Read(storeID, blockID, rsp); err != nil { if err := blockmgr.Read(storeID, blockID, rsp); err != nil {
return &appError{err, "", http.StatusInternalServerError} return &appError{err, "", http.StatusInternalServerError}
} }
sendStatisticMsg(storeID, user, "sync-file-download", uint64(blockSize)) sendStatisticMsg(storeID, user, "sync-file-download", uint64(blockSize))
rsp.WriteHeader(http.StatusOK)
return nil return nil
} }