Skip to content
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

Merged
merged 1 commit into from
Jul 31, 2015

Conversation

michael-berlin
Copy link
Contributor

@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.

…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.
@robpike
Copy link
Contributor

robpike commented Jul 31, 2015

Please sign the Google CLA so I can accept this pull request.

@robpike
Copy link
Contributor

robpike commented Jul 31, 2015

Apologies, this is unnecessary because your employer is OK. Thanks for the PR.

robpike added a commit that referenced this pull request Jul 31, 2015
@robpike robpike merged commit fca8c88 into golang:master Jul 31, 2015
@michael-berlin michael-berlin deleted the fix_log_before_flag_parse branch August 11, 2015 20:57
@thomashargrove
Copy link

Should this comment on line 40 be updated? "// As a result, flag.Parse must be called before any logging is done."

@eparis
Copy link

eparis commented Sep 19, 2016

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 ERROR: logging before flag.Parse:

@tgulacsi
Copy link

Maybe pflag should call flag.CommandLine.Parse(nil) ?

@zombiezen
Copy link

/cc @spf13 @bcmills

@ldez ldez mentioned this pull request Jun 11, 2017
ldez added a commit to ldez/traefik that referenced this pull request Jun 12, 2017
`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
ldez added a commit to traefik/traefik that referenced this pull request Jun 12, 2017
`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
sathieu added a commit to lemonldap-ng-controller/lemonldap-ng-controller that referenced this pull request Jan 30, 2018
k8s-ci-robot pushed a commit to kubernetes/test-infra that referenced this pull request Mar 5, 2020
glog doesn't work well with pflag library (or any other flag replacemnt FWIW),
see golang/glog#13.
DirectXMan12 pushed a commit to DirectXMan12/klog that referenced this pull request Jun 14, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants