Skip to content

Commit

Permalink
Merge "[FAB-6164] Update only modules with prefix at peer st"
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristidis authored and Gerrit Code Review committed Sep 19, 2017
2 parents 472a4bd + 7ea3e4b commit 3f83afc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions common/flogging/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ func TestSetModuleLevel(t *testing.T) {
[]string{"foo/bar", "bar/baz"}, false, false},
testCase{"RegexComplex", []string{"^[a-z]+\\/[a-z]+#.+$", "warning"}, []string{flogging.DefaultLevel(), flogging.DefaultLevel(), "WARNING", "WARNING", "WARNING"},
[]string{"gossip/util", "orderer/util", "gossip/gossip#0.0.0.0:7051", "gossip/conn#-1", "orderer/conn#0.0.0.0:7051"}, false, false},
testCase{"RegexPrefix", []string{"^test", "warning"}, []string{"WARNING", "WARNING", flogging.DefaultLevel()},
[]string{"test", "test/peer", "peer/test"}, false, false},
testCase{"RegexInvalid", []string{"(", "warning"}, []string{flogging.DefaultLevel()},
[]string{"foo"}, false, true},
testCase{"RevertLevels", []string{"revertmodule1", "warning", "revertmodule2", "debug"}, []string{"WARNING", "DEBUG", "DEBUG"},
Expand Down
3 changes: 2 additions & 1 deletion peer/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ func SetLogLevelFromViper(module string) error {
if err != nil {
return err
}
_, err = flogging.SetModuleLevel(module, logLevelFromViper)
// only set logging modules that begin with the supplied module name here
_, err = flogging.SetModuleLevel("^"+module, logLevelFromViper)
return err
}

Expand Down

0 comments on commit 3f83afc

Please sign in to comment.