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

Fix configuration of logger #1259

Merged
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
15 changes: 9 additions & 6 deletions cmd/algorand-indexer/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ func loadIndexerConfig(indexerDataDir string, configFile string) error {
logger.WithError(err).Errorf("invalid config file (%s): %v", viper.ConfigFileUsed(), err)
return err
}
logger.Infof("Using configuration file: %s\n", resolvedConfigPath)
return err
}

Expand Down Expand Up @@ -240,11 +239,6 @@ func loadIndexerParamConfig(cfg *daemonConfig) error {
func runDaemon(daemonConfig *daemonConfig) error {
var err error
config.BindFlagSet(daemonConfig.flags)
err = configureLogger()
if err != nil {
fmt.Fprintf(os.Stderr, "failed to configure logger: %v", err)
return err
}

// Create the data directory if necessary/possible
if err = configureIndexerDataDir(daemonConfig.indexerDataDir); err != nil {
Expand All @@ -263,6 +257,15 @@ func runDaemon(daemonConfig *daemonConfig) error {
return err
}

// Configure the logger after we load all indexer configs
err = configureLogger()
if err != nil {
fmt.Fprintf(os.Stderr, "failed to configure logger: %v", err)
return err
}

logger.Infof("Using configuration file: %s", viper.ConfigFileUsed())

if daemonConfig.pidFilePath != "" {
err = iutil.CreateIndexerPidFile(logger, daemonConfig.pidFilePath)
if err != nil {
Expand Down