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
kubelet: print flags after initializing logging #106520
Conversation
If done too soon, the klog.V() calls are ignored because the log verbosity isn't set. In Kubernetes 1.22, the verbosity was set, but not the logging format.
@pohly: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/wg structured-logging |
@@ -266,6 +265,7 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API | |||
klog.ErrorS(err, "Failed to initialize logging") | |||
os.Exit(1) | |||
} | |||
cliflag.PrintFlags(cleanFlagSet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same pattern as in all other commands which use log options and PrintFlags, for example
kubernetes/cmd/kube-apiserver/app/server.go
Lines 120 to 125 in 3b9bd22
// Activate logging as soon as possible, after that | |
// show flags with the final logging configuration. | |
if err := s.Logs.ValidateAndApply(); err != nil { | |
return err | |
} | |
cliflag.PrintFlags(fs) |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: klueska, pohly The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/milestone v1.23 |
/lgtm |
What type of PR is this?
/kind bug
What this PR does / why we need it:
If done too soon, the klog.V() calls are ignored because the log verbosity
isn't set. In Kubernetes 1.22, the verbosity was set, but not the logging
format.
Which issue(s) this PR fixes:
Fixes #100152
Special notes for your reviewer:
Output is now:
Does this PR introduce a user-facing change?