diff --git a/e2e/etcd_test.go b/e2e/etcd_test.go index 202048b73..3368d3c26 100644 --- a/e2e/etcd_test.go +++ b/e2e/etcd_test.go @@ -337,7 +337,7 @@ func (epc *etcdProcessCluster) Start() (err error) { etcdp.donec = make(chan struct{}) rs := readyStr if etcdp.cfg.isProxy { - rs = "proxy: endpoints found" + rs = "httpproxy: endpoints found" } _, err := etcdp.proc.Expect(rs) readyC <- err diff --git a/proxy/httpproxy/director.go b/proxy/httpproxy/director.go index b2ecbeb97..2495d4878 100644 --- a/proxy/httpproxy/director.go +++ b/proxy/httpproxy/director.go @@ -15,7 +15,6 @@ package httpproxy import ( - "log" "math/rand" "net/url" "sync" @@ -135,10 +134,10 @@ func (ep *endpoint) Failed() { ep.Available = false ep.Unlock() - log.Printf("proxy: marked endpoint %s unavailable", ep.URL.String()) + plog.Printf("marked endpoint %s unavailable", ep.URL.String()) if ep.failFunc == nil { - log.Printf("proxy: no failFunc defined, endpoint %s will be unavailable forever.", ep.URL.String()) + plog.Printf("no failFunc defined, endpoint %s will be unavailable forever.", ep.URL.String()) return } @@ -149,7 +148,7 @@ func timedUnavailabilityFunc(wait time.Duration) func(*endpoint) { return func(ep *endpoint) { time.AfterFunc(wait, func() { ep.Available = true - log.Printf("proxy: marked endpoint %s available, to retest connectivity", ep.URL.String()) + plog.Printf("marked endpoint %s available, to retest connectivity", ep.URL.String()) }) } } diff --git a/proxy/httpproxy/reverse.go b/proxy/httpproxy/reverse.go index 8a94a748a..64d082445 100644 --- a/proxy/httpproxy/reverse.go +++ b/proxy/httpproxy/reverse.go @@ -19,7 +19,6 @@ import ( "fmt" "io" "io/ioutil" - "log" "net" "net/http" "net/url" @@ -76,8 +75,9 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request if clientreq.Body != nil { proxybody, err = ioutil.ReadAll(clientreq.Body) if err != nil { - msg := fmt.Sprintf("proxy: failed to read request body: %v", err) - e := httptypes.NewHTTPError(http.StatusInternalServerError, msg) + msg := fmt.Sprintf("failed to read request body: %v", err) + plog.Println(msg) + e := httptypes.NewHTTPError(http.StatusInternalServerError, "httpproxy: "+msg) if we := e.WriteTo(rw); we != nil { plog.Debugf("error writing HTTPError (%v) to %s", we, clientreq.RemoteAddr) } @@ -95,12 +95,12 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request endpoints := p.director.endpoints() if len(endpoints) == 0 { - msg := "proxy: zero endpoints currently available" + msg := "zero endpoints currently available" reportRequestDropped(clientreq, zeroEndpoints) // TODO: limit the rate of the error logging. - log.Printf(msg) - e := httptypes.NewHTTPError(http.StatusServiceUnavailable, msg) + plog.Println(msg) + e := httptypes.NewHTTPError(http.StatusServiceUnavailable, "httpproxy: "+msg) if we := e.WriteTo(rw); we != nil { plog.Debugf("error writing HTTPError (%v) to %s", we, clientreq.RemoteAddr) } @@ -117,7 +117,7 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request select { case <-closeCh: atomic.StoreInt32(&requestClosed, 1) - log.Printf("proxy: client %v closed request prematurely", clientreq.RemoteAddr) + plog.Printf("client %v closed request prematurely", clientreq.RemoteAddr) cancel() case <-completeCh: } @@ -142,7 +142,7 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request } if err != nil { reportRequestDropped(clientreq, failedSendingRequest) - log.Printf("proxy: failed to direct request to %s: %v", ep.URL.String(), err) + plog.Printf("failed to direct request to %s: %v", ep.URL.String(), err) ep.Failed() continue } @@ -152,10 +152,10 @@ func (p *reverseProxy) ServeHTTP(rw http.ResponseWriter, clientreq *http.Request if res == nil { // TODO: limit the rate of the error logging. - msg := fmt.Sprintf("proxy: unable to get response from %d endpoint(s)", len(endpoints)) + msg := fmt.Sprintf("unable to get response from %d endpoint(s)", len(endpoints)) reportRequestDropped(clientreq, failedGettingResponse) - log.Printf(msg) - e := httptypes.NewHTTPError(http.StatusBadGateway, msg) + plog.Println(msg) + e := httptypes.NewHTTPError(http.StatusBadGateway, "httpproxy: "+msg) if we := e.WriteTo(rw); we != nil { plog.Debugf("error writing HTTPError (%v) to %s", we, clientreq.RemoteAddr) }