Skip to content

Commit

Permalink
Merge pull request #4961 from dmarkhas/allow_klog
Browse files Browse the repository at this point in the history
feat: don't discard klog logs at the highest log levels (debug and trace)
  • Loading branch information
k8s-ci-robot authored Dec 26, 2024
2 parents 8907080 + 7debf8a commit 30ccbcb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ func main() {
}
log.SetLevel(ll)

// Klog V2 is used by k8s.io/apimachinery/pkg/labels and can throw (a lot) of irrelevant logs
// See https://github.com/kubernetes-sigs/external-dns/issues/2348
defer klog.ClearLogger()
klog.SetLogger(logr.Discard())
if ll < log.DebugLevel {
// Klog V2 is used by k8s.io/apimachinery/pkg/labels and can throw (a lot) of irrelevant logs
// See https://github.com/kubernetes-sigs/external-dns/issues/2348
defer klog.ClearLogger()
klog.SetLogger(logr.Discard())
}

ctx, cancel := context.WithCancel(context.Background())

Expand Down

0 comments on commit 30ccbcb

Please sign in to comment.