crossplane / provider-template

A template for building @crossplane providers.
https://crossplane.io
Apache License 2.0
137 stars 76 forks source link

SetLogger was never called #105

Open malins opened 4 months ago

malins commented 4 months ago

Hello,

my provider based on this template outputs the following warning:

[controller-runtime] log.SetLogger(...) was never called, logs will not be displayed:
goroutine 29 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
sigs.k8s.io/controller-runtime/pkg/log.eventuallyFulfillRoot()
        sigs.k8s.io/controller-runtime@v0.15.1/pkg/log/log.go:59 +0xbd
sigs.k8s.io/controller-runtime/pkg/log.(*delegatingLogSink).WithValues(0xc000525980, {0xc00059e440, 0x2, 0x2})
        sigs.k8s.io/controller-runtime@v0.15.1/pkg/log/deleg.go:168 +0x54
github.com/go-logr/logr.Logger.WithValues(...)
        github.com/go-logr/logr@v1.2.4/logr.go:323
sigs.k8s.io/controller-runtime/pkg/builder.(*Builder).doController.func1(0xc00059e420)
        sigs.k8s.io/controller-runtime@v0.15.1/pkg/builder/controller.go:398 +0x16b
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler(0xc000595220, {0x1e1cb10, 0xc00051f770}, {0x19bfee0?, 0xc00059e400?})
        sigs.k8s.io/controller-runtime@v0.15.1/pkg/internal/controller/controller.go:305 +0x18b
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem(0xc000595220, {0x1e1cb10, 0xc00051f770})
        sigs.k8s.io/controller-runtime@v0.15.1/pkg/internal/controller/controller.go:265 +0x1d9
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2()
        sigs.k8s.io/controller-runtime@v0.15.1/pkg/internal/controller/controller.go:226 +0x85
created by sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2
        sigs.k8s.io/controller-runtime@v0.15.1/pkg/internal/controller/controller.go:222 +0x587

How can I avoid this? General logging seems to work fine.

cychiang commented 3 months ago

This is because of the L64 in the main function. Enable debug feature will not see those errors.