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

[logging] Extra flag problem #427

Closed
gaocegege opened this issue Mar 1, 2018 · 4 comments
Closed

[logging] Extra flag problem #427

gaocegege opened this issue Mar 1, 2018 · 4 comments

Comments

@gaocegege
Copy link
Member

Now we use flag package to support command line flags, and glog also uses it by default. Then you can see our binary have more flags than we thing although we use logrus instead of glog:

➜  tf-operator git:(416) ✗ ./tf-operator -h               
Usage of ./tf-operator:
  -alsologtostderr
    	log to standard error as well as files
  -chaos-level int
    	DO NOT USE IN PRODUCTION - level of chaos injected into the TFJob created by the operator. (default -1)
  -controller-config-file string
    	Path to file containing the controller config.
  -gc-interval duration
    	GC interval (default 10m0s)
  -json-log-format
    	Set true to use json style log format. Set false to use plaintext style log format (default true)
  -log_backtrace_at value
    	when logging hits line file:N, emit a stack trace
  -log_dir string
    	If non-empty, write log files in this directory
  -logtostderr
    	log to standard error instead of files
  -stderrthreshold value
    	logs at or above this threshold go to stderr
  -v value
    	log level for V logs
  -version
    	Show version and quit
  -vmodule value
    	comma-separated list of pattern=N settings for file-filtered logging

There are some pros and cons:

  • We can support vendor and client's glog, since we have glog's flags
  • But the users may be confused since the tf-operator outputs logs regardless of the flag -logtostderr
@gaocegege
Copy link
Member Author

We can refer to etcd/etcd-operator, which also uses logrus.

@lovejoy
Copy link
Contributor

lovejoy commented Sep 5, 2018

How can i set this flags to log to a dir and the log file same as the stderr .Now I tried to set -log_dir but the log file have less log than stderr

@gaocegege
Copy link
Member Author

sirupsen/logrus#156

@stale
Copy link

stale bot commented Apr 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants