diff options
| author | Brian Goff <cpuguy83@gmail.com> | 2023-03-21 17:45:14 +0000 |
|---|---|---|
| committer | Brian Goff <cpuguy83@gmail.com> | 2023-03-21 21:01:10 +0000 |
| commit | c7ccc68b15fc0fc8c2a8683170e6d61e3381e358 (patch) | |
| tree | 9e125e7261deb7e4d8d62c880452985072130599 /cmd | |
| parent | 7489b51f610104ab5acc43f4e77142927e7b522e (diff) | |
| download | docker-c7ccc68b15fc0fc8c2a8683170e6d61e3381e358.tar.gz | |
Silence GRPC logs unless our log level is debug
GRPC is logging a *lot* of garbage at info level.
This configures the GRPC logger such that it is only giving us logs when
at debug level and also adds a log field indicating where the logs are
coming from.
containerd is still currently spewing these same log messages and needs
a separate update.
Without this change `docker build` is extremely noisy in the daemon
logs.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/dockerd/docker.go | 1 | ||||
| -rw-r--r-- | cmd/dockerd/grpclog.go | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/cmd/dockerd/docker.go b/cmd/dockerd/docker.go index 3c594a0878..da11a0cfdd 100644 --- a/cmd/dockerd/docker.go +++ b/cmd/dockerd/docker.go @@ -87,6 +87,7 @@ func main() { _, stdout, stderr := term.StdStreams() initLogging(stdout, stderr) + configureGRPCLog() onError := func(err error) { fmt.Fprintf(stderr, "%s\n", err) diff --git a/cmd/dockerd/grpclog.go b/cmd/dockerd/grpclog.go new file mode 100644 index 0000000000..2d726c7f76 --- /dev/null +++ b/cmd/dockerd/grpclog.go @@ -0,0 +1,17 @@ +package main + +import ( + "github.com/sirupsen/logrus" + "google.golang.org/grpc/grpclog" +) + +// grpc's default logger is *very* noisy and uses "info" and even "warn" level logging for mostly useless messages. +// This function configures the grpc logger to step down the severity of all messages. +// +// info => trace +// warn => debug +// error => warn +func configureGRPCLog() { + l := logrus.WithField("library", "grpc") + grpclog.SetLoggerV2(grpclog.NewLoggerV2(l.WriterLevel(logrus.TraceLevel), l.WriterLevel(logrus.DebugLevel), l.WriterLevel(logrus.WarnLevel))) +} |
