feat(logging): forward grpc internal logging to zap #1029
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This continues on from a discussion in the original logrus to zap PR: #1020
This forwards all gRPC internal logging into zap.
Originally, I tried to use
grpc_zap.ReplaceGrpcLoggerV2
in the first PR, which led to lots of gRPC chatter in the logs.This was because the default zap level for all Flipt logs was INFO and gRPC has a lot of INFO chatter.
Normally, the default severity level for gRPC is
ERROR
. Which is why you don't see this.My first attempt to improve this tapped into the env var
GRPC_GO_LOG_SEVERITY_LEVEL
.However, this had the interesting effect of both forwarding logs to zap and printing gRPC logs in their native log format to stdout/stderr.
Instead, I have now introduced a new flipt compatible
log.grpc_level
option.This option defaults to
ERROR
level. So that the default behaviour is as expected.However, the grpc log level can always be increased independently up to the main flipt log-level (but not exceed).
see:
FLIPT_LOG_GRPC_LEVEL
Normal behaviour is as expected:
Increased gRPC log-level forwards to zap:
Signed-off-by: George MacRorie me@georgemac.com