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>
(cherry picked from commit c7ccc68b15
)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
8fdca288c5
commit
8a6bec6e16
2 changed files with 18 additions and 0 deletions
|
@ -88,6 +88,7 @@ func main() {
|
|||
_, stdout, stderr := term.StdStreams()
|
||||
|
||||
initLogging(stdout, stderr)
|
||||
configureGRPCLog()
|
||||
|
||||
onError := func(err error) {
|
||||
fmt.Fprintf(stderr, "%s\n", err)
|
||||
|
|
17
cmd/dockerd/grpclog.go
Normal file
17
cmd/dockerd/grpclog.go
Normal file
|
@ -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)))
|
||||
}
|
Loading…
Reference in a new issue