Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logic in WriteJSONToResponse to log errors in ECS agent log #2641

Merged
merged 1 commit into from
Sep 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions agent/handlers/utils/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func WriteJSONToResponse(w http.ResponseWriter, httpStatusCode int, responseJSON
"Unable to write %s json response message to ResponseWriter",
requestType)
}

if httpStatusCode >= 400 && httpStatusCode <= 599 {
seelog.Errorf("HTTP response status code is '%d', request type is: %s, and response in JSON is %s", httpStatusCode, requestType, string(responseJSON))
}
}

// WriteResponseIfMarshalError checks the 'err' response of the json.Marshal function.
Expand Down