-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: x/net: Accept client-provided logger for http2 debug logs in addition to GODEBUG=http2debug=1,2 #52734
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
Comments
This proposal has been added to the active column of the proposals project |
In the spirit of minimal change and consistency with the I would then personally be ok with all logs going to Alternatively (I can spec this out with more effort if interested), each struct in the package could have a |
Adding grpclog.LoggerV2 to any package in std is a non-starter. That's an enormous interface. What about *log.Logger instead (from the standard log package)? Or just an io.Writer? We are also thinking about whether to revamp logging in std generally. Maybe we should hold this for that work. /cc @jba |
Getting useful log information and directing it to a desired location are reasonable desires, but I don't think slapping an additional public API on the The |
An interface would be better than
Well, as someone who works on those at the protocol level I'd say yes (if it's a cheap language addition) but I recognize that's relatively niche.
Just to provide a counter example, I got to this point because I was debugging random stalls over a high-throughput gRPC connection and it turned out the HTTP/2 debug logs held the key to the fix:
Seeing a flood of these told me I needed to increase initial connection window sizes on both ends; I think the only way I could have tackled this problem without logs was to start trying knobs until something panned out. |
We should probably put this on hold until we have a clearer story about what to do about logging generally, starting with package log. |
Placed on hold. |
This allows me to get HTTP/2 debug logs: https://github.com/golang/net/blob/290c469a71a567d354e4abd335577aba44c4bde4/http2/http2.go#L41-L50
...But unlike the gRPC package, I can't specify my own logger. I also can't change the log level at runtime (I can toggle
VerboseLogs
since that's exported, but notlogFrameWrites
andlogFrameReads
).For logging format consistency and runtime configuration of log levels it would be great to provide my own logger. I suppose this would also require a switch to level-based logging instead of e.g.
log.Printf()
; I don't know if the structure of logs is covered by the Go compatibility guarantee and if so this would need to be done in a way that doesn't break it (maybe alldebug
level with no formatting change in the default logger implementation?)Thanks for considering this!
The text was updated successfully, but these errors were encountered: