From 009b737cef2f0b7c271ea1a7b5f52d453d54040d Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Sat, 25 Oct 2014 21:37:13 -0700 Subject: [PATCH] *: better logging --- etcdserver/server.go | 2 +- etcdserver/server_test.go | 2 ++ main.go | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/etcdserver/server.go b/etcdserver/server.go index 27dac2641..5c2f2cb7a 100644 --- a/etcdserver/server.go +++ b/etcdserver/server.go @@ -526,7 +526,7 @@ func (s *EtcdServer) publish(retryInterval time.Duration) { cancel() switch err { case nil: - log.Printf("etcdserver: published %+v to the cluster", s.attributes) + log.Printf("etcdserver: published %+v to cluster %x", s.attributes, s.Cluster.ID()) return case ErrStopped: log.Printf("etcdserver: aborting publish because server is stopped") diff --git a/etcdserver/server_test.go b/etcdserver/server_test.go index 110e6028e..3a5ae5568 100644 --- a/etcdserver/server_test.go +++ b/etcdserver/server_test.go @@ -974,6 +974,7 @@ func TestPublish(t *testing.T) { srv := &EtcdServer{ id: 1, attributes: Attributes{Name: "node1", ClientURLs: []string{"http://a", "http://b"}}, + Cluster: &Cluster{}, node: n, w: w, } @@ -1007,6 +1008,7 @@ func TestPublish(t *testing.T) { func TestPublishStopped(t *testing.T) { srv := &EtcdServer{ node: &nodeRecorder{}, + Cluster: &Cluster{}, w: &waitRecorder{}, done: make(chan struct{}), stopped: make(chan struct{}), diff --git a/main.go b/main.go index 4445bb2e7..0339077bf 100644 --- a/main.go +++ b/main.go @@ -195,7 +195,7 @@ func startEtcd() { // Start the peer server in a goroutine urlStr := u.String() go func() { - log.Print("Listening for peers on ", urlStr) + log.Print("etcd: listening for peers on ", urlStr) log.Fatal(http.Serve(l, ph)) }() } @@ -214,7 +214,7 @@ func startEtcd() { urlStr := u.String() go func() { - log.Print("Listening for client requests on ", urlStr) + log.Print("etcd: listening for client requests on ", urlStr) log.Fatal(http.Serve(l, ch)) }() } @@ -266,7 +266,7 @@ func startProxy() { host := u.Host go func() { - log.Print("Listening for client requests on ", host) + log.Print("etcd: proxy listening for client requests on ", host) log.Fatal(http.Serve(l, ph)) }() }