diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-12-02 15:17:27 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-12-02 15:17:27 +0300 |
commit | e2148d83e953bef15bb274a4c4f3327356296877 (patch) | |
tree | 930ec86fc48b664ea147d07f2e893c1ba16ccebf | |
parent | 332bac63f5708e9004e91b538d79acb842800725 (diff) | |
parent | ec2dbf85c67f2defdb0083de60ecb3a26ce5ef2b (diff) |
Merge branch 'jc-fix-unstructured-startup-logging' into 'master'
Configure logging as early as possible
Closes #2185
See merge request gitlab-org/gitaly!1666
-rw-r--r-- | changelogs/unreleased/jc-fix-unstructured-startup-logging.yml | 5 | ||||
-rw-r--r-- | cmd/gitaly/main.go | 15 | ||||
-rw-r--r-- | cmd/praefect/main.go | 7 |
3 files changed, 20 insertions, 7 deletions
diff --git a/changelogs/unreleased/jc-fix-unstructured-startup-logging.yml b/changelogs/unreleased/jc-fix-unstructured-startup-logging.yml new file mode 100644 index 000000000..fb0752112 --- /dev/null +++ b/changelogs/unreleased/jc-fix-unstructured-startup-logging.yml @@ -0,0 +1,5 @@ +--- +title: Configure logging as early as possible +merge_request: 1666 +author: +type: other diff --git a/cmd/gitaly/main.go b/cmd/gitaly/main.go index f8860df2c..8635084a7 100644 --- a/cmd/gitaly/main.go +++ b/cmd/gitaly/main.go @@ -46,6 +46,12 @@ func main() { flag.Usage = flagUsage flag.Parse() + configPath := flag.Arg(0) + if err := loadConfig(configPath); err != nil { + log.WithError(err).WithField("config_path", configPath).Fatal("load config") + } + config.ConfigureLogging() + // gitaly-wrapper is supposed to set config.EnvUpgradesEnabled in order to enable graceful upgrades _, isWrapped := os.LookupEnv(config.EnvUpgradesEnabled) b, err := bootstrap.New(os.Getenv(config.EnvPidFile), isWrapped) @@ -66,12 +72,6 @@ func main() { log.WithField("version", version.GetVersionString()).Info("Starting Gitaly") - configPath := flag.Arg(0) - if err := loadConfig(configPath); err != nil { - log.WithError(err).WithField("config_path", configPath).Fatal("load config") - } - - config.ConfigureLogging() sentry.ConfigureSentry(version.GetVersion(), sentry.Config(config.Config.Logging.Sentry)) config.ConfigurePrometheus() config.ConfigureConcurrencyLimits() @@ -145,9 +145,12 @@ func run(b *bootstrap.Bootstrap) error { return fmt.Errorf("unable to start the bootstrap: %v", err) } + log.Info("Bootstrap started") + if err := servers.StartRuby(); err != nil { return fmt.Errorf("initialize gitaly-ruby: %v", err) } + log.Info("Bootstrap waiting") return b.Wait() } diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go index 8fb6c0c9c..b0b3063a1 100644 --- a/cmd/praefect/main.go +++ b/cmd/praefect/main.go @@ -138,7 +138,12 @@ func run(cfgs []starter.Config, conf config.Config) error { return fmt.Errorf("unable to start the bootstrap: %v", err) } - go func() { serverErrors <- b.Wait() }() + logger.Info("Bootstrap started") + + go func() { + logger.Info("Bootstrap waiting") + serverErrors <- b.Wait() + }() go func() { serverErrors <- repl.ProcessBacklog(ctx) }() go coordinator.FailoverRotation() |