diff --git a/cmd/roles/roles.go b/cmd/roles/roles.go index 0ce5e88547..a68146c562 100644 --- a/cmd/roles/roles.go +++ b/cmd/roles/roles.go @@ -210,8 +210,10 @@ func (mr *MilvusRoles) runDataCoord(ctx context.Context, localMsg bool) *compone f := setLoggerFunc() datacoord.Params.BaseParams.SetLogConfig(f) factory := newMsgFactory(localMsg) + + dctx := logutil.WithModule(ctx, "DataCoord") var err error - ds, err = components.NewDataCoord(ctx, factory) + ds, err = components.NewDataCoord(dctx, factory) if err != nil { panic(err) } diff --git a/internal/datacoord/server.go b/internal/datacoord/server.go index b3d1456bec..affe0e11e5 100644 --- a/internal/datacoord/server.go +++ b/internal/datacoord/server.go @@ -214,9 +214,9 @@ func (s *Server) QuitSignal() <-chan struct{} { func (s *Server) Register() error { s.session.Register() go s.session.LivenessCheck(s.serverLoopCtx, func() { - log.Error("DataCoord disconnected from etcd and exited", zap.Int64("ServerID", s.session.ServerID)) + logutil.Logger(s.ctx).Error("disconnected from etcd and exited", zap.Int64("serverID", s.session.ServerID)) if err := s.Stop(); err != nil { - log.Fatal("failed to stop server", zap.Error(err)) + logutil.Logger(s.ctx).Fatal("failed to stop server", zap.Error(err)) } // manually send signal to starter goroutine syscall.Kill(syscall.Getpid(), syscall.SIGINT) @@ -291,7 +291,7 @@ func (s *Server) Start() error { Params.DataCoordCfg.CreatedTime = time.Now() Params.DataCoordCfg.UpdatedTime = time.Now() atomic.StoreInt64(&s.isServing, ServerStateHealthy) - log.Debug("DataCoord startup success") + logutil.Logger(s.ctx).Debug("startup success") return nil }