diff --git a/cmd/agent/main.go b/cmd/agent/main.go index 10498c9ad..af97301a1 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -36,9 +36,11 @@ func main() { flags.AddFlagSet(o.Flags()) local := flag.NewFlagSet(os.Args[0], flag.ExitOnError) klog.InitFlags(local) - err := local.Set("v", "4") - if err != nil { - fmt.Fprintf(os.Stderr, "error setting klog flags: %v", err) + if local.Lookup("v") == nil { + err := local.Set("v", "4") + if err != nil { + fmt.Fprintf(os.Stderr, "error setting klog flags: %v", err) + } } local.VisitAll(func(fl *flag.Flag) { fl.Name = util.Normalize(fl.Name) diff --git a/cmd/server/main.go b/cmd/server/main.go index fdb1a736b..3bad77eec 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -36,9 +36,11 @@ func main() { flags.AddFlagSet(o.Flags()) local := flag.NewFlagSet(os.Args[0], flag.ExitOnError) klog.InitFlags(local) - err := local.Set("v", "4") - if err != nil { - fmt.Fprintf(os.Stderr, "error setting klog flags: %v", err) + if local.Lookup("v") == nil { + err := local.Set("v", "4") + if err != nil { + fmt.Fprintf(os.Stderr, "error setting klog flags: %v", err) + } } local.VisitAll(func(fl *flag.Flag) { fl.Name = util.Normalize(fl.Name)