Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: print welcom after config init #454

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func NewServer(ctx context.Context, sctx *sctx.Context) (srv *Server, err error)
return
}
srv.LoggerManager.Init(srv.ConfigManager.WatchConfig())
printInfo(lg)

// setup config manager
if err = srv.ConfigManager.Init(ctx, lg.Named("config"), sctx.ConfigFile, &sctx.Overlay); err != nil {
Expand All @@ -70,6 +69,14 @@ func NewServer(ctx context.Context, sctx *sctx.Context) (srv *Server, err error)
}
cfg := srv.ConfigManager.GetConfig()

// welcome messages must be printed after initialization of configmager, because
// logfile backended zaplogger is enabled after cfgmgr.Init(..).
// otherwise, printInfo will output to stdout, which can not be redirected to the log file on tiup-cluster.
//
// TODO: there is a race condition that printInfo and logmgr may concurrently execute:
// logmgr may havenot been initialized with logfile yet
printInfo(lg)
xhebox marked this conversation as resolved.
Show resolved Hide resolved

// setup metrics
srv.MetricsManager.Init(ctx, lg.Named("metrics"))
metrics.ServerEventCounter.WithLabelValues(metrics.EventStart).Inc()
Expand Down