fix: Disable ErrorLog in http.Server (#1244)

Vault does similarly: e2490059d0/command/server.go (L2714)

These messages have primarily been noise.
This commit is contained in:
Kyle Carberry 2022-05-01 20:31:12 -05:00 committed by GitHub
parent b948f2dab5
commit 9b37a0de31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,8 @@ import (
"encoding/pem"
"errors"
"fmt"
"io"
"log"
"net"
"net/http"
"net/url"
@ -263,7 +265,10 @@ func server() *cobra.Command {
go func() {
defer close(errCh)
server := http.Server{
Handler: handler,
// These errors are typically noise like "TLS: EOF". Vault does similar:
// https://github.com/hashicorp/vault/blob/e2490059d0711635e529a4efcbaa1b26998d6e1c/command/server.go#L2714
ErrorLog: log.New(io.Discard, "", 0),
Handler: handler,
BaseContext: func(_ net.Listener) context.Context {
return shutdownConnsCtx
},