Skip to content

Commit 907fd1f

Browse files
committed
[FAB-6315] Submodule log level override at peer start
This CR enables overriding the default log level for a submodule at peer start (e.g. peer/gossip). In order to set these variables from both yaml files and environment variables, the submodule name must be supplied using periods instead of the forward slashes used in logging module names, hence the replacement of periods with forward slashes. Change-Id: I58234e6e81641709e84b8df28162539d53c7126f Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
1 parent 9eead80 commit 907fd1f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

peer/common/common.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package common
1919
import (
2020
"fmt"
2121
"os"
22+
"strings"
2223

2324
"github.com/hyperledger/fabric/bccsp/factory"
2425
"github.com/hyperledger/fabric/common/channelconfig"
@@ -208,6 +209,9 @@ func SetLogLevelFromViper(module string) error {
208209
if err != nil {
209210
return err
210211
}
212+
// replace period in module name with forward slash to allow override
213+
// of logging submodules
214+
module = strings.Replace(module, ".", "/", -1)
211215
// only set logging modules that begin with the supplied module name here
212216
_, err = flogging.SetModuleLevel("^"+module, logLevelFromViper)
213217
return err

0 commit comments

Comments
 (0)