Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Change default log level to 2 #9093

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bootstrap/kubeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions controlplane/kubeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/developer/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ for log levels; as a small integration on the above guidelines we would like to
the code; a person reading those logs usually has deep knowledge of the codebase.
- Don’t use verbosity higher than 5.

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
We are using log level 2 as a default verbosity for all core Cluster API
controllers as recommended by the Kubernetes guidelines.

## Trade-offs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

// Validates logs flags using Kubernetes component-base machinery and applies them
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions test/extension/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

// Validates logs flags using Kubernetes component-base machinery and apply them
Expand Down
5 changes: 5 additions & 0 deletions test/infrastructure/docker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ func main() {
initFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

if err := logsv1.ValidateAndApply(logOptions, nil); err != nil {
Expand Down
5 changes: 5 additions & 0 deletions test/infrastructure/inmemory/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ func main() {
InitFlags(pflag.CommandLine)
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
// Set log level 2 as default.
if err := pflag.CommandLine.Set("v", "2"); err != nil {
setupLog.Error(err, "failed to set log level: %v")
os.Exit(1)
}
pflag.Parse()

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