From 4cc66c502e351f7fc12337a4a6376123dee60789 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Fri, 17 Aug 2018 15:33:15 -0400 Subject: [PATCH] Pass in an ErrorLog to http.Server Fixes #5108 --- command/server.go | 1 + http/testing.go | 5 +++-- vault/request_forwarding.go | 3 +++ vault/testing.go | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/command/server.go b/command/server.go index 501da04883de..cd2a60f8a770 100644 --- a/command/server.go +++ b/command/server.go @@ -979,6 +979,7 @@ CLUSTER_SYNTHESIS_COMPLETE: ReadHeaderTimeout: 10 * time.Second, ReadTimeout: 30 * time.Second, IdleTimeout: 5 * time.Minute, + ErrorLog: c.logger.StandardLogger(nil), } go server.Serve(ln.Listener) } diff --git a/http/testing.go b/http/testing.go index f390b5f42b75..ebc2edd1b698 100644 --- a/http/testing.go +++ b/http/testing.go @@ -33,8 +33,9 @@ func TestServerWithListenerAndProperties(tb testing.TB, ln net.Listener, addr st mux.Handle("/", Handler(props)) server := &http.Server{ - Addr: ln.Addr().String(), - Handler: mux, + Addr: ln.Addr().String(), + Handler: mux, + ErrorLog: core.Logger().StandardLogger(nil), } go server.Serve(ln) } diff --git a/vault/request_forwarding.go b/vault/request_forwarding.go index 0c54d774280c..0c8175c52e17 100644 --- a/vault/request_forwarding.go +++ b/vault/request_forwarding.go @@ -211,6 +211,9 @@ func (c *Core) startForwarding(ctx context.Context) error { go func() { fws.ServeConn(tlsConn, &http2.ServeConnOpts{ Handler: fwRPCServer, + BaseConfig: &http.Server{ + ErrorLog: c.logger.StandardLogger(nil), + }, }) // close the quitCh which will close the connection and // the other goroutine. diff --git a/vault/testing.go b/vault/testing.go index 1c0c7484a64a..fbe90791b0ae 100644 --- a/vault/testing.go +++ b/vault/testing.go @@ -1110,7 +1110,8 @@ func NewTestCluster(t testing.T, base *CoreConfig, opts *TestClusterOptions) *Te var handler http.Handler = http.NewServeMux() handlers = append(handlers, handler) server := &http.Server{ - Handler: handler, + Handler: handler, + ErrorLog: logger.StandardLogger(nil), } servers = append(servers, server) }