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

Server errors don't actually log #118

Closed
halkeye opened this issue Mar 2, 2022 · 3 comments · Fixed by #155
Closed

Server errors don't actually log #118

halkeye opened this issue Mar 2, 2022 · 3 comments · Fixed by #155
Labels
bug Something isn't working go Pull requests that update Go code

Comments

@halkeye
Copy link

halkeye commented Mar 2, 2022

Looking at https://github.com/grpc-ecosystem/go-grpc-middleware/blob/master/logging/logrus/ctxlogrus/context.go#L36 it looks like you need to call ctxlogrus.ToContext(context) first, before you can call extract.

I can't find ToContext being called. This makes https://github.com/freifunkMUC/wg-access-server/blob/master/internal/services/middleware.go#L22 a null logger.

@DasSkelett DasSkelett added bug Something isn't working go Pull requests that update Go code labels Mar 2, 2022
@DasSkelett
Copy link
Member

Are you sure this doesn't work? Manually triggering an error logs this:

ERRO[0010]device_service.go:46 test error  grpc.method=ListDevices grpc.service=proto.Devices grpc.start_time="2022-03-02T14:08:21+01:00" span.kind=server system=grpc trace.id=84adf761-1751-49e3-b3ec-d770e88d92b8
ERRO[0010]options.go:224 finished unary call with code Internal  error="rpc error: code = Internal desc = failed to retrieve devices" grpc.code=Internal grpc.method=ListDevices grpc.service=proto.Devices grpc.start_time="2022-03-02T14:08:21+01:00" grpc.time_ms=0.691 span.kind=server system=grpc trace.id=84adf761-1751-49e3-b3ec-d770e88d92b8

I'm not familiar with this logging infrastructure, and the docs are a bit confusing. But from what I can tell, errors that happen in the grpc API do get logged.

@halkeye
Copy link
Author

halkeye commented Mar 2, 2022

Ah it probably works for grpc. I was having oauth errors, so not the grpc

Maybe the better solution is for the middleware to check if extract returns something.ill poke at it more.

@halkeye
Copy link
Author

halkeye commented Mar 3, 2022

okay so grpc-ecosystem/go-grpc-middleware#467 describes the issue pretty well. Sadly there's no way to opt out of this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working go Pull requests that update Go code
Projects
None yet
2 participants