mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 13:55:55 +00:00
Setup logging for Raft properly
This commit is contained in:
parent
f062e31be7
commit
9e7feea454
@ -179,14 +179,14 @@ func (s *Server) setupRaft() error {
|
|||||||
s.raftStore = store
|
s.raftStore = store
|
||||||
|
|
||||||
// Create the snapshot store
|
// Create the snapshot store
|
||||||
snapshots, err := raft.NewFileSnapshotStore(path, 3)
|
snapshots, err := raft.NewFileSnapshotStore(path, 3, s.config.LogOutput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
store.Close()
|
store.Close()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a transport layer
|
// Create a transport layer
|
||||||
trans := raft.NewNetworkTransport(s.raftLayer, 3, 10*time.Second)
|
trans := raft.NewNetworkTransport(s.raftLayer, 3, 10*time.Second, s.config.LogOutput)
|
||||||
s.raftTransport = trans
|
s.raftTransport = trans
|
||||||
|
|
||||||
// Setup the peer store
|
// Setup the peer store
|
||||||
@ -202,6 +202,9 @@ func (s *Server) setupRaft() error {
|
|||||||
s.raftPeers.SetPeers(raft.AddUniquePeer(peers, trans.LocalAddr()))
|
s.raftPeers.SetPeers(raft.AddUniquePeer(peers, trans.LocalAddr()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure we set the LogOutput
|
||||||
|
s.config.RaftConfig.LogOutput = s.config.LogOutput
|
||||||
|
|
||||||
// Setup the Raft store
|
// Setup the Raft store
|
||||||
s.raft, err = raft.NewRaft(s.config.RaftConfig, s.fsm, store, store,
|
s.raft, err = raft.NewRaft(s.config.RaftConfig, s.fsm, store, store,
|
||||||
snapshots, s.raftPeers, trans)
|
snapshots, s.raftPeers, trans)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user