-
Notifications
You must be signed in to change notification settings - Fork 6
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
stop logging errors for api error responses #8
Conversation
From a cursory glance, when a real error occurs, we already log something at the application layer, so there's no reason to echo every api error response as an error log too. Errors should be actionable, but these logs were not, e.g.: > access denied to templates or: > category ID specified in input does not exist for user
@lieut-data can you point to where this is happening? For the two examples provided, I don't see where the error is logged in the application layer. Worried that we may be missing seeing actual errors in the log with changing for all that call |
Co-authored-by: Maria A Nunez <[email protected]>
Oops, I didn't meant to frame it as such, @marianunez: the two examples are "non-actionable" errors, and indeed there are no additional error logs expected from the application layer. With this change, we'll still log a warning when an API returns a failure code to the client, but the default position is to assume these aren't actionable (i.e. permission issues). There are examples of actionable errors in the app layer, e.g.: mattermost-plugin-boards/server/app/initialize.go Lines 10 to 16 in 0b6e443
but I note they are not consistent. There are certainly opportunities for greater consistency here. |
I see, makes sense. Thanks for clarifying |
@@ -178,7 +178,6 @@ func (a *API) userIsGuest(userID string) (bool, error) { | |||
// Response helpers | |||
|
|||
func (a *API) errorResponse(w http.ResponseWriter, r *http.Request, err error) { | |||
a.logger.Error(err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This explains the double log entries for each error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
Summary
From a cursory glance, when a real error occurs, we already log something at the application layer, so there's no reason to echo every api error response as an error log too. Errors should be actionable, but these logs were not, e.g.:
or:
This PR duplicates mattermost-community/focalboard#5022.
Ticket Link
Fixes: https://mattermost.atlassian.net/browse/MM-59325