mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-10-21 15:30:24 +00:00
Provide the option to not to log via STDERR
Today, Multus will always log via STDERR, and these logs will then logged by the Kubelet. If we also choose to have Multus log to a file by setting the LogFile option in the CNI configuration, the same logs will be logged twice. This commit provide the option to disable logging to STDERR. Signed-off-by: Yun Zhou <yunz@nvidia.com>
This commit is contained in:
committed by
Tomofumi Hayashi
parent
5141eab28a
commit
dc9315f125
@@ -257,7 +257,8 @@ func GetGatewayFromResult(result *current.Result) []net.IP {
|
||||
|
||||
// LoadNetConf converts inputs (i.e. stdin) to NetConf
|
||||
func LoadNetConf(bytes []byte) (*NetConf, error) {
|
||||
netconf := &NetConf{}
|
||||
// LogToStderr's default value set to true
|
||||
netconf := &NetConf{LogToStderr: true}
|
||||
|
||||
logging.Debugf("LoadNetConf: %s", string(bytes))
|
||||
if err := json.Unmarshal(bytes, netconf); err != nil {
|
||||
@@ -265,6 +266,7 @@ func LoadNetConf(bytes []byte) (*NetConf, error) {
|
||||
}
|
||||
|
||||
// Logging
|
||||
logging.SetLogStderr(netconf.LogToStderr)
|
||||
if netconf.LogFile != "" {
|
||||
logging.SetLogFile(netconf.LogFile)
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ type NetConf struct {
|
||||
DefaultNetworks []string `json:"defaultNetworks"`
|
||||
LogFile string `json:"logFile"`
|
||||
LogLevel string `json:"logLevel"`
|
||||
LogToStderr bool `json:"logToStderr,omitempty"`
|
||||
RuntimeConfig *RuntimeConfig `json:"runtimeConfig,omitempty"`
|
||||
// Default network readiness options
|
||||
ReadinessIndicatorFile string `json:"readinessindicatorfile"`
|
||||
|
Reference in New Issue
Block a user