From 71f02adfca7d44d6050243453ee0d8fa8f497426 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 9 Feb 2023 09:27:27 +0530 Subject: [PATCH] Revert "Print golang http errors in MinIO log format (#16465)" This reverts commit 1fd7946dce38550114c53fb863194a71fc63d40b. --- cmd/server-main.go | 2 +- cmd/utils.go | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/cmd/server-main.go b/cmd/server-main.go index 3678ef389..ffab3bbd2 100644 --- a/cmd/server-main.go +++ b/cmd/server-main.go @@ -590,7 +590,7 @@ func serverMain(ctx *cli.Context) { UseIdleTimeout(ctx.Duration("idle-timeout")). UseReadHeaderTimeout(ctx.Duration("read-header-timeout")). UseBaseContext(GlobalContext). - UseCustomLogger(log.New(&goHTTPLogger{}, "", 0)) + UseCustomLogger(log.New(io.Discard, "", 0)) // Turn-off random logging by Go stdlib go func() { globalHTTPServerErrorCh <- httpServer.Start(GlobalContext) diff --git a/cmd/utils.go b/cmd/utils.go index ee8b559b1..0c0f21d09 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -1245,13 +1245,3 @@ func MockOpenIDTestUserInteraction(ctx context.Context, pro OpenIDClientAppParam // fmt.Printf("TOKEN: %s\n", rawIDToken) return rawIDToken, nil } - -// Custom logger for golang http logs -type goHTTPLogger struct{} - -func (goHTTPLogger) Write(p []byte) (int, error) { - // Golang std logger ensures that the error message will be sent - // in one Write call so it is okay to print it directly. - logger.LogOnceIf(context.Background(), fmt.Errorf("%s", string(p)), "go-http-logging") - return len(p), nil -}