-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Proposal: provide a SetLog() func #18
Comments
Would love to have a proper log interface & be able to provide an impl that the client could use. glog is a bit invasive here. |
Thank you for this k8s client. It's very helpful. Do you have any advice around suppressing glog's hoisting of its command line flags into the help output of tools that use the k8s client. For example, those flags whose descriptions are not decorated with "MyApp" are coming from glog's init function: https://github.com/golang/glog/blob/master/glog.go#L398
|
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
/remove-lifecycle stale |
I would also appreciate having this feature. We're currently building tooling around client-go without using glog, so we would love to have the ability to override it. |
If we undertake the effort to switch logging frameworks, (It's not just going to be client-go), we need to have
@lavalamp @eparis @bparees you've also dealt with our logging shortcomings, other things to add to the list? I'm disinclined to undertake the effort of a replacement that didn't address those requirements. |
@deads2k that covers my wishlist, anyway. I suppose rate limiting or de-duping might be nice options as well, but not must haves. |
I agree those are nice to have. I think that given pluggable filters and handlers it is possible to build de-duping and rate limiting. Given pieces to build them, I won't block progress on not having them. |
If you're wanting structured logs, then you really have to replace all usage of glog (even from our dependencies) in order to be useful ("almost all JSON" log output doesn't really do much good)
same comment about logger usage by dependencies |
The same sort of argument would apply to Mixing log4j and jsr47 doesn't work perfectly, but you don't have to have perfect coherence for big gains. |
In our projects, we have more that 80 services with countless of dependencies and so far we had no problem with structured logging (except from k8s/client-go). I found that usually dependencies just use the log.Logger interface for logging. Could you make a list of dependencies that use glog? |
Sadly it does seem reasonable to want glog to not be mandatory to use the client. This would be a fairly large effort, though. We'd have to define a new logging interface & provide a glog implementation which gives zero difference from today. (glog's interface is not easy (or possible, even?) to reimplement due to the If we had an interface and a 100% compatible glog implementation, we could slowly roll changes out. But it's a lot of effort. |
Technically you can reimplement
This way you won't hit the "go language defect" @lavalamp is referring to and client-go will use your logging library without any code change. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle rotten |
/remove-lifecycle stale |
does anyone know a workaround for this? I'd like to set the format for glog logs, or disable it all together. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Since client-go now uses klog, doesn't klog.SetLogger() fulfill this proposal? https://github.com/kubernetes/klog/blob/8422fac62d1e961e89426ffb5ae3a07f2d0bcca2/klog.go#L776 |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
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. |
To be able to use klog.SetLogger() client-go needs to start using k8s.io/klog/v2 |
/remove-lifecycle rotten |
Is it possible to provide a
SetLog()
in the packages? For example, I'm using 3cache.NewInformer
to watch for changes on 3 different resources, but if, for whatever reason, the connection between the client and the apiserver doesn't exist, I have this error messages in my log:I would like to at least change the layout to be the same as my logs or/and silent the log messages until I get a new kubernetes connection.
The text was updated successfully, but these errors were encountered: