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.raftTransport = trans
// Make sure we set the LogOutput.
s.config.RaftConfig.LogOutput = s.config.LogOutput
// Make sure we set the Logger.
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
// 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 != "" {
conf.Tags[AutopilotVersionTag] = s.config.UpgradeVersion
}
conf.MemberlistConfig.LogOutput = s.config.LogOutput
conf.LogOutput = s.config.LogOutput
logger := s.logger.StandardLogger(&log.StandardLoggerOptions{InferLevels: true})
conf.MemberlistConfig.Logger = logger
conf.Logger = logger
conf.MemberlistConfig.LogOutput = nil
conf.LogOutput = nil
conf.EventCh = ch
if !s.config.DevMode {
conf.SnapshotPath = filepath.Join(s.config.DataDir, path)