Skip to content

Commit a6317fb

Browse files
committed
Change default log level to 2
Signed-off-by: Stefan Büringer [email protected]
1 parent a0f2568 commit a6317fb

File tree

8 files changed

+36
-1
lines changed

8 files changed

+36
-1
lines changed

bootstrap/kubeadm/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ func main() {
165165
InitFlags(pflag.CommandLine)
166166
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
167167
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
168+
// Set log level 2 as default.
169+
if err := pflag.CommandLine.Set("v", "2"); err != nil {
170+
setupLog.Error(err, "failed to set log level: %v")
171+
os.Exit(1)
172+
}
168173
pflag.Parse()
169174

170175
if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {

controlplane/kubeadm/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ func main() {
169169
InitFlags(pflag.CommandLine)
170170
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
171171
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
172+
// Set log level 2 as default.
173+
if err := pflag.CommandLine.Set("v", "2"); err != nil {
174+
setupLog.Error(err, "failed to set log level: %v")
175+
os.Exit(1)
176+
}
172177
pflag.Parse()
173178

174179
if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {

docs/book/src/developer/logging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ for log levels; as a small integration on the above guidelines we would like to
117117
the code; a person reading those logs usually has deep knowledge of the codebase.
118118
- Don’t use verbosity higher than 5.
119119

120-
Ideally, in a future release of Cluster API we will switch to use 2 as a default verbosity (currently it is 0) for all the Cluster API
120+
We are using log level 2 as a default verbosity for all core Cluster API
121121
controllers as recommended by the Kubernetes guidelines.
122122

123123
## Trade-offs

docs/book/src/tasks/experimental-features/runtime-sdk/implement-extensions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ func main() {
9595
InitFlags(pflag.CommandLine)
9696
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
9797
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
98+
// Set log level 2 as default.
99+
if err := pflag.CommandLine.Set("v", "2"); err != nil {
100+
setupLog.Error(err, "failed to set log level: %v")
101+
os.Exit(1)
102+
}
98103
pflag.Parse()
99104

100105
// Validates logs flags using Kubernetes component-base machinery and applies them

main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ func main() {
228228
InitFlags(pflag.CommandLine)
229229
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
230230
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
231+
// Set log level 2 as default.
232+
if err := pflag.CommandLine.Set("v", "2"); err != nil {
233+
setupLog.Error(err, "failed to set log level: %v")
234+
os.Exit(1)
235+
}
231236
pflag.Parse()
232237

233238
if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {

test/extension/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ func main() {
106106
InitFlags(pflag.CommandLine)
107107
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
108108
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
109+
// Set log level 2 as default.
110+
if err := pflag.CommandLine.Set("v", "2"); err != nil {
111+
setupLog.Error(err, "failed to set log level: %v")
112+
os.Exit(1)
113+
}
109114
pflag.Parse()
110115

111116
// Validates logs flags using Kubernetes component-base machinery and apply them

test/infrastructure/docker/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ func main() {
167167
initFlags(pflag.CommandLine)
168168
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
169169
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
170+
// Set log level 2 as default.
171+
if err := pflag.CommandLine.Set("v", "2"); err != nil {
172+
setupLog.Error(err, "failed to set log level: %v")
173+
os.Exit(1)
174+
}
170175
pflag.Parse()
171176

172177
if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {

test/infrastructure/inmemory/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ func main() {
159159
InitFlags(pflag.CommandLine)
160160
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
161161
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
162+
// Set log level 2 as default.
163+
if err := pflag.CommandLine.Set("v", "2"); err != nil {
164+
setupLog.Error(err, "failed to set log level: %v")
165+
os.Exit(1)
166+
}
162167
pflag.Parse()
163168

164169
if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {

0 commit comments

Comments
 (0)