-
Notifications
You must be signed in to change notification settings - Fork 910
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
Export glog bugfix. #13
Export glog bugfix. #13
Conversation
…ed before flag.Parse(). Before this change, premature logging resulted into log files being put in the default location (e.g. /tmp), but not the one specified by the log_dir flag. After this change, premature logging will not result into the creation of the log files yet. Instead, the log message will be printed to stderr.
Please sign the Google CLA so I can accept this pull request. |
Apologies, this is unnecessary because your employer is OK. Thanks for the PR. |
Should this comment on line 40 be updated? "// As a result, flag.Parse must be called before any logging is done." |
This breaks people who don't use the golang standard flag parsing library. Such as those who use https://github.com/spf13/pflag to get posix like flag parsing. Well, it doesn't break, but it prepends every log line with and incorrect |
Maybe pflag should call flag.CommandLine.Parse(nil) ? |
`golang/glog` is used by: - `github.com/mesos/mesos-go` (no version) - `k8s.io/client-go` (`44145f04b68cf362d9c4df2182967c2275eaefed`) In traefik#353 (add Mesos provider, 20 Jul 2016), the `golang/glog` hash is `fca8c8854093a154ff1eb580aae10276ad6b1b5f`. The problem appear in traefik#836 (use k8s client, 1 Dec 2016). Refs: - Traefik: - traefik#836 - traefik@131f581 - Glog - https://github.com/golang/glog/commits/master - golang/glog#13 - golang/glog@44145f0 - golang/glog@fca8c88 - k8s - https://github.com/kubernetes/client-go/blob/e121606b0d09b2e1c467183ee46217fa85a6b672/Godeps/Godeps.json - https://github.com/kubernetes/client-go/blob/master/Godeps/Godeps.json
`golang/glog` is used by: - `github.com/mesos/mesos-go` (no version) - `k8s.io/client-go` (`44145f04b68cf362d9c4df2182967c2275eaefed`) In #353 (add Mesos provider, 20 Jul 2016), the `golang/glog` hash is `fca8c8854093a154ff1eb580aae10276ad6b1b5f`. The problem appear in #836 (use k8s client, 1 Dec 2016). Refs: - Traefik: - #836 - 131f581 - Glog - https://github.com/golang/glog/commits/master - golang/glog#13 - golang/glog@44145f0 - golang/glog@fca8c88 - k8s - https://github.com/kubernetes/client-go/blob/e121606b0d09b2e1c467183ee46217fa85a6b672/Godeps/Godeps.json - https://github.com/kubernetes/client-go/blob/master/Godeps/Godeps.json
glog doesn't work well with pflag library (or any other flag replacemnt FWIW), see golang/glog#13.
implements the glog API, but redirects to klog implementation. Makes it easy to use `dep` overrides to quickly switch/try the klog implementation. Change-Id: Ibdf4b25ed3b17e761c3fdea449f80add76a9070f
@robpike This is an export of an internal bug fix. The original author is @Sajmani
Fix problem that -log_dir will not be respected when anything is logged before flag.Parse().
Before this change, premature logging resulted into log files being put in the default location (e.g. /tmp), but not the one specified by the log_dir flag.
After this change, premature logging will not result into the creation of the log files yet. Instead, the log message will be printed to stderr.