From 41cab5d69f237d489e752e58eb7fbec59f2638fb Mon Sep 17 00:00:00 2001 From: bingoohuang Date: Thu, 28 May 2020 08:56:55 +0800 Subject: [PATCH] log JSON response if httpStatus >= 400 --- weed/server/common.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/weed/server/common.go b/weed/server/common.go index f064ca707..150b9d954 100644 --- a/weed/server/common.go +++ b/weed/server/common.go @@ -46,6 +46,12 @@ func writeJson(w http.ResponseWriter, r *http.Request, httpStatus int, obj inter if err != nil { return } + + if httpStatus >= 400 { + glog.V(0).Infof("response method:%s URL:%s with httpStatus:%d and JSON:%s", + r.Method, r.URL.String(), httpStatus, string(bytes)) + } + callback := r.FormValue("callback") if callback == "" { w.Header().Set("Content-Type", "application/json")