Skip to content

Commit dfc06c6

Browse files
denyeartmanish-sethi
authored andcommitted
Log peer config upon startup (#4118)
Log peer config upon startup. Also log peer environment variables to help troubleshoot peer config. Signed-off-by: David Enyeart <[email protected]>
1 parent 0d55eee commit dfc06c6

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

internal/peer/node/start.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ import (
9898
"github.com/spf13/cobra"
9999
"github.com/spf13/viper"
100100
"google.golang.org/grpc"
101+
"gopkg.in/yaml.v2"
101102
)
102103

103104
const (
@@ -185,6 +186,23 @@ func (c custodianLauncherAdapter) Stop(ccid string) error {
185186
}
186187

187188
func serve(args []string) error {
189+
logger.Infof("Starting %s", version.GetInfo())
190+
191+
// Info logging for peer config, includes core.yaml settings and environment variable overrides
192+
allSettings := viper.AllSettings()
193+
settingsYaml, err := yaml.Marshal(allSettings)
194+
if err != nil {
195+
return err
196+
}
197+
logger.Infof("Peer config with combined core.yaml settings and environment variable overrides:\n%s", settingsYaml)
198+
199+
// Debug logging for peer environment variables
200+
logger.Debugf("Environment variables:")
201+
envVars := os.Environ()
202+
for _, envVar := range envVars {
203+
logger.Debug(envVar)
204+
}
205+
188206
// currently the peer only works with the standard MSP
189207
// because in certain scenarios the MSP has to make sure
190208
// that from a single credential you only have a single 'identity'.
@@ -201,9 +219,7 @@ func serve(args []string) error {
201219
// and was racy with respect to initialization of gRPC clients and servers.
202220
grpc.EnableTracing = true
203221

204-
logger.Infof("Starting %s", version.GetInfo())
205-
206-
//obtain coreConfiguration
222+
// obtain coreConfiguration
207223
coreConfig, err := peer.GlobalConfig()
208224
if err != nil {
209225
return err

0 commit comments

Comments
 (0)