-
Notifications
You must be signed in to change notification settings - Fork 39.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
Use of glog for logging is problematic #61006
Comments
@kubernetes/sig-architecture-feature-requests |
@obeattie: Reiterating the mentions to trigger a notification: 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. |
Personal 2¢: while replacing glog completely with something else might be the best long-term solution, doing so seems like it would be a long road. Coming to a consensus on a replacement and rewriting all existing calls to glog to use that replacement doesn't seem like it will happen quickly. The problems caused by this are quite harmful now, so I think it's pragmatic to mitigate those without replacing glog completely. It seems like that would involve something like:
I'd be happy to take a go at this, but it's probably only worthwhile doing that if there's enough agreement that it would be an acceptable thing to do (a PR that changes the glog import path would benefit from merging pretty fast since it would get out of date very quickly.) |
@obeattie thanks for enumerating these issue in full, I agree with all of them and we should start doing something about it. I think most developers are partly aware of some of these issues, but I am not sure if anyone else has enumerated these issues as well as you did here. |
I agree glog should be fixed, forked or replaced. Interested in your view @thockin |
I was part of the initial Twitter thread - my main concerns are: the A forked/updated glog should ideally not run The override should ideally not mandate the use of args/flags to configure logging. To the point @thockin raised by his Go logging interface project (mentioned in the tweet thread) - there should be an interface available so that the underlying test framework/implementation can be abstracted away from the consuming code. |
Related issue: coredns/coredns#1597 (closed) |
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. |
@obeattie wdyt? |
/remove-lifecycle stale |
Creating a more complete list of requirements and desirable properties would be useful. |
2 more problems with glog I'd like to add:
+1. I think a sensible path forward would be:
|
long-term-issue (note to self) |
@tallclair @alexellis @bboreham @munnerz @thockin @bgrant0607 Here's an experiment for forking glog into the k/k repo - #69333 |
I'd love to see us move to something like https://github.com/go-logr/logr (planned to rename to lager, maybe?) and I am willing to help strategize how. Starting at leaf packages and working backwards, we should be able to replace the |
I guess there are 2 different approaches here with the same end goal:
Some of the problems with our current logging approach are addressed with a new interface, while others are better addressed with a new backend. I guess which approach we take depends somewhat on which set of problems we're prioritizing. |
Prometheus is also infected: |
Also in this space is go-log/log, which aims for the simpler printf-style approach from Dave's blog. I'm definitely in favor of having a pluggable interface of some sort for this to enable client-go (and other library) consumers to plug in their own implementation, which may not be glog or a fork of glog). |
FYI, main k/k repo is now using |
klog PR is #70889 |
Please see https://groups.google.com/d/msg/kubernetes-dev/7vnijOMhLS0/1oRiNtigBgAJ I'd love to see follow ups on what can be done better now that we have /close |
@dims: 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. |
FEATURE REQUEST:
/kind feature
What happened:
Kubernetes uses golang/glog extensively for logging. While this is reasonable enough for the Kubernetes binaries, sizeable parts of the codebase are re-used as client libraries (eg.
k8s.io/client-go
). This presents several problems for users of the libraries:init
function, and offers no programmatic way to configure its behaviour. It can be surprising to users of the k8s libraries that they have to callflag.Parse()
, and this is easy to get wrong (eg. No way to configure glog coredns/coredns#1597).os.Exit
. This can be very harmful, and since it's common to run containerised binaries with a read-only root filesystem, can be easy to trigger.logrotate
running (especially problematic in a container) the log files just accumulate.I think we need to find a way to fix this: the use of glog makes working with the k8s client libraries very difficult. A recent Twitter discussion on this topic shows this is a widely-held concern.
The text was updated successfully, but these errors were encountered: