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

Override glog's default for the -logtostderr flag #664

Closed
klingerf opened this issue Apr 2, 2018 · 5 comments
Closed

Override glog's default for the -logtostderr flag #664

klingerf opened this issue Apr 2, 2018 · 5 comments

Comments

@klingerf
Copy link
Member

klingerf commented Apr 2, 2018

In #524 we started setting the -logtostderr=true flag on all of the controller components in the kubernetes configs that are output by the conduit install command. This fixed the issue described in #522, but it would be better to fix this in a way that didn't require modifying every command line invocation of every controller component.

We should be able to call flag.Set in our code to accomplish this, per: https://twitter.com/fatih/status/980918398417817600

@briansmith
Copy link
Contributor

In case the Tweet gets deleted, it's just putting this into the main module and removing the CLI arguments:

func init() {
    flag.Set("logtostderr", "true")
}

@klingerf klingerf added this to the 0.6.0 milestone Jun 15, 2018
@klingerf
Copy link
Member Author

I'd like to propose that we start sending all glog message to /dev/null instead of writing them the stderr. I've only ever seen glog messages printed at controller startup before the proxy is initialized. These messages are harmless but can be alarming. I think it would better to suppress them altogether, and rely on our own logging implementation to tell us if there's a problem.

@klingerf
Copy link
Member Author

Note that we can still default sending glog message to /dev/null using the flag.Set approach that's suggested in the description for this issue.

@grampelberg grampelberg added the priority/P2 Nice-to-have for Release label Jul 16, 2018
@grampelberg grampelberg added priority/P1 Planned for Release and removed priority/P2 Nice-to-have for Release labels Jul 16, 2018
@klingerf
Copy link
Member Author

We should enable glog logging to stderr if -log-level=debug, otherwise we should suppress glog logs.

@klingerf klingerf self-assigned this Jul 23, 2018
@klingerf
Copy link
Member Author

klingerf commented Jul 25, 2018

I took some time to read the glog source, and unfortunately it appears that it's not possible for us to disable glog logs on a readonly filesystem. This relates to kubernetes/kubernetes#61006. Glog writes its logs to either stderr or to a directory on disk, and we have to write to stderr since our processes are running inside scratch containers and can't write to disk.

I'll still use this issue to track overriding glog's default settings to log to stderr automatically, which will allow us to remove the -logtostderr flags from our install config.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants