Serf/Raft/Memberlist logger

This commit is contained in:
Alex Dadgar 2018-09-17 13:57:52 -07:00
parent cac3348601
commit b2f500b48c
1 changed files with 9 additions and 4 deletions

View File

@ -1089,8 +1089,10 @@ func (s *Server) setupRaft() error {
s.config.LogOutput) s.config.LogOutput)
s.raftTransport = trans s.raftTransport = trans
// Make sure we set the LogOutput. // Make sure we set the Logger.
s.config.RaftConfig.LogOutput = s.config.LogOutput logger := s.logger.StandardLogger(&log.StandardLoggerOptions{InferLevels: true})
s.config.RaftConfig.Logger = logger
s.config.RaftConfig.LogOutput = nil
// Our version of Raft protocol requires the LocalID to match the network // Our version of Raft protocol requires the LocalID to match the network
// address of the transport. // address of the transport.
@ -1253,8 +1255,11 @@ func (s *Server) setupSerf(conf *serf.Config, ch chan serf.Event, path string) (
if s.config.UpgradeVersion != "" { if s.config.UpgradeVersion != "" {
conf.Tags[AutopilotVersionTag] = s.config.UpgradeVersion conf.Tags[AutopilotVersionTag] = s.config.UpgradeVersion
} }
conf.MemberlistConfig.LogOutput = s.config.LogOutput logger := s.logger.StandardLogger(&log.StandardLoggerOptions{InferLevels: true})
conf.LogOutput = s.config.LogOutput conf.MemberlistConfig.Logger = logger
conf.Logger = logger
conf.MemberlistConfig.LogOutput = nil
conf.LogOutput = nil
conf.EventCh = ch conf.EventCh = ch
if !s.config.DevMode { if !s.config.DevMode {
conf.SnapshotPath = filepath.Join(s.config.DataDir, path) conf.SnapshotPath = filepath.Join(s.config.DataDir, path)