-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
kubectl: rationalize which messages to stderr/stdout #3894
Comments
I've seen that log before, and actually, it should be log.V(4). Internal things like polling actions shouldn't appear in logs unless the command is run with --v=# |
@smarterclayton @ghodss What is the desired behavior? I thought that logging to stderr, and user facing output to stdout was sort of the expected behavior. |
Can sometimes be - in this case we're leveraging stdout for "things you might want to script" and stderr for "logs and pretty info". So create returns only the name of the thing created, so you can (in theory)
Create/Delete/Update return the names of the things - get does stdout. I'm not sure these rules have to be followed (although get -q is something we need to add). ----- Original Message -----
|
I do want to preserve and improve scriptability. It's a line item in cli-roadmap.md. All user-friendly messages should go to stderr. I'd like full objects and other machine-readable info to go to stdout. We should provided an option to simply output names, partial URLs (for objects of multiple kinds, namespaces, etc.), whatever that can be provided back to kubectl as command-line arguments. I could also imagine a completely silent mode that just produces a useful exit code. |
We also need -q or equiv for get so you can easily pipe to xargs. That's on my list, as well as delete all.
|
My opinion: stderr is for errors, full stop. kubectl help get -> stdout, user asked for it kubectl gett -> stderr, user made a mistake
|
Time to research! http://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout One thing that stands out - stdout is what you pipe to the next program, full stop. If you'd grep it, it would be on stdout. If you'd pipe it to xargs, it's stdout. If you need to see it, but don't care much past that... it's probably stderr. The section on help docs in the first link matches my experience - usage "errors" are always stderr. Help output is probably more accurately stdout (I asked you for help). |
Also, if ordering matters, you probably want to keep it all on one stream. I.e. grep errors can be out of band (and potentially be flushed later than message), but trying to deliver things out of order. |
Printing anything the user asked for is stdout. Printing the json of an
|
Yup, agree.
|
Help output to stdout -- sure, fine. |
Table headers should be to stderr. ----- Original Message -----
|
no. They are not errors. On Thu, Jan 29, 2015 at 7:37 AM, Clayton Coleman notifications@github.com
|
I thought we just had the thing where the Unix way is to separate things that are output and part of the shell composition pattern from the things that are output and are not? How does osc get | grep Run -> returns header help me? ----- Original Message -----
|
Table headers are part of the output you asked for. ps, df, netstate, etc all print table headers to stdout. I have never On Thu, Jan 29, 2015 at 9:45 AM, Clayton Coleman notifications@github.com
|
Because you want to grep / xargs / table headers amrite? I'm not going to go to the wall for this one, but do you normally redirect things to files more often than you pipe them? Since we can turn off table headers via flag I don't really care that much.
|
Honestly, given a table with enough columns I actually DO want the header. I will go to the wall - dumping things that are not errors to stderr is On Thu, Jan 29, 2015 at 10:41 AM, Clayton Coleman notifications@github.com
|
Turning off headers is the solution for people who don't want them is fine. Or |
Turning off headers via flag is the usual solution. I find the thought of On Thu, Jan 29, 2015 at 10:55 PM, Brian Grant notifications@github.com
|
Yeah, since we have --no-headers we're good. Headers was maybe a bad example. ----- Original Message -----
|
So are we in fact saying that glog going to stderr is fine, and therefore this issue can be closed? Or should we parse out some glog messages (like info) to go to stdout? Just not clear on what actually needs to be changed here given the above thread. |
The glog prefixes on CLIs are terrible. Unless you're at --v=3 or higher writing the standard glog gorp to the screen is abusive to new users.
|
This - all glog stuff < ERROR should be silent unless -v is set, though we On Wed, Feb 11, 2015 at 6:02 PM, Clayton Coleman notifications@github.com
|
Yeah, i just picked 3 randomly cause we said 2 is "normal" operation ----- Original Message -----
|
Seems like the specific info message mentioned at the top of this ticket was removed in #3921. Combined with the fact that we don't plan on changing the current stdout/stderr split seems means we can close this issue. If we want to change glog prefixes we can probably make a new issue for that. |
Since the purpose of this issue was to decide what messages go to stdout/stderr, I think we can close this out and open separate bugs for specific output that isn't doing the right thing. Summary of decisions:
|
glog prefixing ----- Original Message -----
|
A user reports to google-containers@googlegroups.com (https://groups.google.com/forum/#!topic/google-containers/qHDR-mvh7sM) the following. I verified similar behavior in kubectl v0.9.1.
I am using Kubernetes v0.7.0, when I run "kubectl" to create pod, I found:
$ kubectl create -s http://192.168.122.136:8080 -f ./mariadb-pod.yaml
I0128 22:09:44.258267 30016 restclient.go:133] Waiting for completion of operation 19 --> this is to stderr
mariadb --> this is to stdout
I do not know why the message "...Waiting for completion ..." is considered as an error, I think it should be to stdout too.
The text was updated successfully, but these errors were encountered: