File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ var loggingCmd = &cobra.Command{
47
47
// note: for code running on the peer, this level is set during peer startup
48
48
// in peer/node/start.go and can be updated dynamically using
49
49
// "peer logging setlevel error <log-level>"
50
- return common .SetErrorLoggingLevel ( )
50
+ return common .SetLogLevelFromViper ( "error" )
51
51
},
52
52
Short : fmt .Sprintf ("%s specific commands." , loggingFuncName ),
53
53
Long : fmt .Sprintf ("%s specific commands." , loggingFuncName ),
Original file line number Diff line number Diff line change @@ -104,12 +104,14 @@ func GetAdminClient() (pb.AdminClient, error) {
104
104
return adminClient , nil
105
105
}
106
106
107
- // SetErrorLoggingLevel sets the 'error' module's logger to the value in
107
+ // SetLogLevelFromViper sets the log level for ' module' logger to the value in
108
108
// core.yaml
109
- func SetErrorLoggingLevel () error {
110
- viperErrorLoggingLevel := viper .GetString ("logging.error" )
111
- _ , err := flogging .SetModuleLevel ("error" , viperErrorLoggingLevel )
112
-
109
+ func SetLogLevelFromViper (module string ) error {
110
+ var err error
111
+ if module != "" {
112
+ logLevelFromViper := viper .GetString ("logging." + module )
113
+ _ , err = flogging .SetModuleLevel (module , logLevelFromViper )
114
+ }
113
115
return err
114
116
}
115
117
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ logging:
36
36
version : warning
37
37
protoutils : debug
38
38
error : warning
39
+ msp : warning
39
40
40
41
format : ' %{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}'
41
42
Original file line number Diff line number Diff line change @@ -230,10 +230,11 @@ func serve(args []string) error {
230
230
}()
231
231
}
232
232
233
- // sets the logging level for the 'error' module to the default value from
234
- // core.yaml. it can also be updated dynamically using
235
- // "peer logging setlevel error <log-level>"
236
- common .SetErrorLoggingLevel ()
233
+ // sets the logging level for the 'error' and 'msp' modules to the
234
+ // values from core.yaml. they can also be updated dynamically using
235
+ // "peer logging setlevel <module-name> <log-level>"
236
+ common .SetLogLevelFromViper ("error" )
237
+ common .SetLogLevelFromViper ("msp" )
237
238
238
239
// Block until grpc server exits
239
240
return <- serve
You can’t perform that action at this time.
0 commit comments