1
0
mirror of https://github.com/containous/traefik.git synced 2024-12-23 17:34:13 +03:00

Write HTTP server logs into the global logger.

This commit is contained in:
Ludovic Fernandez 2019-09-09 14:52:04 +02:00 committed by Traefiker Bot
parent be90b20a5d
commit 25f4c23ab2

View File

@ -3,6 +3,7 @@ package server
import (
"context"
"fmt"
stdlog "log"
"net"
"net/http"
"sync"
@ -16,10 +17,13 @@ import (
"github.com/containous/traefik/v2/pkg/middlewares/forwardedheaders"
"github.com/containous/traefik/v2/pkg/safe"
"github.com/containous/traefik/v2/pkg/tcp"
"github.com/sirupsen/logrus"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
)
var httpServerLogger = stdlog.New(log.WithoutContext().WriterLevel(logrus.DebugLevel), "", 0)
type httpForwarder struct {
net.Listener
connChan chan net.Conn
@ -352,7 +356,8 @@ func createHTTPServer(ln net.Listener, configuration *static.EntryPoint, withH2c
}
serverHTTP := &http.Server{
Handler: handler,
Handler: handler,
ErrorLog: httpServerLogger,
}
listener := newHTTPForwarder(ln)