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
CONSOLE-1523: Switch logging to klog #1862
Conversation
/assign @spadgett |
Hm, I didn't realize this was going to pull in so many additional dependencies like API machinery. Build is failing:
|
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.
I'd expect a V(<some-number>)
for most info logging.
@spadgett - I went ahead and set the level for all the info log stmts. |
I'd like to evaluate this since it's bringing in so many new dependencies. Holding for the moment. /hold |
That seems very reasonable. |
Are 2 dependency commits needed, or can that be squashed into 1 commit? |
@benjaminapetersen - I am just leaving this one alone until @spadgett decides if he wants to add it. I can squash things whenever we decide to take the hold off. |
go.mod
Outdated
google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8 // indirect | ||
google.golang.org/grpc v1.19.0 | ||
gopkg.in/square/go-jose.v2 v2.0.1 // indirect | ||
gopkg.in/yaml.v2 v2.2.1 | ||
gopkg.in/yaml.v2 v2.2.2 | ||
k8s.io/component-base v0.0.0-20190627205834-327675bd8ec3 |
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.
Is k8s.io/component-base
needed? https://github.com/kubernetes/klog/blob/master/go.mod
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.
Guessing this is why the blow up.
On further investigation, the
I can try removing the dependency to |
@zherman0 @jhadvig Does this require openshift/console-operator#250 ? |
@spadgett - This change is de-coupled from the console operator change (PR250). The PR 250 gets rid of the log level flag from being sent over in capnlog style, but we handle that flag still and just show a message saying it has been deprecated. |
yes, it should get merged afterwards. It doesn't matter what will be the merge sequence |
/hold cancel |
@jhadvig please review, thanks! |
cmd/bridge/main.go
Outdated
} | ||
} | ||
|
||
func setLogLevel(val string) (string, error) { |
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.
@zherman0 don't think this function is needed, since it's not used anywhere. Do you recall whats the purpose by any chance, so we dont overlook anything.
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 function is only for anywhere that people might still be using the the log level so we can informed them it is deprecated. It is not needed but I don't think it hurts to tell people of the change. If we leave it, then we should probably remove it in a release or 2.
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.
/lgtm
/approve
/assign @yapei @ahardin-rh @sferich888 This PR switches internally for the capnslog library to klog for logging in the console backend. @zherman0 @jhadvig Are there any changes to the operator config for this PR that might impact docs? |
Don't think will impact docs, since the operator config is not going to change. ccing @zherman0 |
} | ||
} | ||
|
||
if *fInactivityTimeout < 300 { | ||
log.Warning("Flag inactivity-timeout is set to less then 300 seconds and will be ignored!") | ||
klog.Warning("Flag inactivity-timeout is set to less then 300 seconds and will be ignored!") |
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.
@zherman0 For changes from log
to klog
, when viewing console logs, how can we differentiate them?
On a 4.6 cluster, I see console log is showing:
2020-10-19T23:47:06Z cmd/main: Flag inactivity-timeout is set to less then 300 seconds and will be ignored!
While on a cluster with changes in this PR, it shows:
sh-4.4$ /opt/bridge/bin/bridge --log-level 5
W1020 05:55:37.303295 25 main.go:211] Flag inactivity-timeout is set to less then 300 seconds and will be ignored!
W1020 05:55:37.303578 25 main.go:254] DEPRECATED: --log-level is now deprecated, use verbosity flag --v=Level instead
How can I know Flag inactivity-timeout is set to less then 300 seconds and will be ignored!
is printed with klog
?
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.
@yapei not sure why we need to differentiate between them?
How can I know Flag inactivity-timeout is set to less then 300 seconds and will be ignored! is printed with klog?
Since we will be using just klog
for the backend logging we dont need to differentiate between anything.
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.
Agreed, not sure why you need to tell the difference, but the new klog stuff shows the file name and line number main.go:211
if that helps.
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.
Yeah, the line number tells the truth @zherman0
When verifying the bug Logging is broken due to mix of k8s.io/klog v1 and v2
we need to confirm whether klog v2 is used. So I thought for this PR we may have same verification process which means I need to confirm klog
is used instead of old logging. That's' my thought but maybe I'm wrong @jhadvig @zherman0
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.
@yapei @spadgett @zherman0 just one thing to notice here. The console
backend will be using the klog/v1
since we need to update helm
pkg if we want to use the klog/v2
. On the other hand the console-operator
moved by this PR to using the klog/v2
. This should not do any harm since those are two different binaries.
Just want to point out the difference here and also think out loud about the upgrading to klog/v2
for the console backend binary.
The issue with the helm
is that the release we are using (and the latest as well) is using k8s 1.18.0
pkgs version. In order not to have import collisions they need to be on the 1.19.2.
, which their master is on currently , they just need to release it.
👍 from the docs side |
/label qe-approved |
/label docs-approved |
/label px-approved |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhadvig, spadgett, zherman0 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 |
In order to become more consistent, I have remove the use of capnslog in favor of the k8s.io klog. Also, to handle the transition of log level values from the console operator, I have created a convert helper function that handles both klog and capnslog values.
See CONSOLE-1523