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

Configure logger for gokit handlers #153

Open
joe94 opened this issue Mar 23, 2021 · 1 comment
Open

Configure logger for gokit handlers #153

joe94 opened this issue Mar 23, 2021 · 1 comment
Assignees
Milestone

Comments

@joe94
Copy link
Member

joe94 commented Mar 23, 2021

The handlers in this file https://github.com/xmidt-org/argus/blob/main/store/handler.go#L40 could be configured with gokit's ServerErrorHandler option to at least log all the errors.

@joe94 joe94 changed the title Configure handlers with gokit logger Configure logger with gokit handlers Mar 23, 2021
@joe94 joe94 changed the title Configure logger with gokit handlers Configure logger for gokit handlers Mar 23, 2021
@joe94 joe94 added this to the v0.3.14 milestone Mar 25, 2021
@joe94
Copy link
Member Author

joe94 commented Sep 24, 2021

After @kristinapathak pointed out that the docs explicitly say that logging should be done in the ServerErrorEncoder even when the ServerErrorLogger got deprecated for the ServerErrorHandler, I think (if we're interested in logging errors such as "ItemNotFound"), we could log them at the debug level in the ServerErrorEncoder
Source:
https://pkg.go.dev/github.com/go-kit/kit/transport/http#ServerErrorHandler

ServerErrorHandler is used to handle non-terminal errors. 
By default, non-terminal errors are ignored. This is intended as a diagnostic measure. 
Finer-grained control of error handling, including logging in more detail, should be performed 
in a custom ServerErrorEncoder or ServerFinalizer, both of which have access to the context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants