etcdmain: fix logging flag documentation

This commit is contained in:
Barak Michener 2015-04-28 16:29:58 -04:00
parent 2299e35d99
commit ad8e3ea5dc
4 changed files with 24 additions and 7 deletions

View File

@ -149,6 +149,17 @@ The security flags help to [build a secure etcd cluster][security].
+ Path to the peer server TLS trusted CA file. + Path to the peer server TLS trusted CA file.
+ default: none + default: none
### Logging Flags
##### -debug
+ Drop the default log level to DEBUG for all subpackages.
+ default: false (INFO for all packages)
##### -log-package-levels
+ Set individual etcd subpackages to specific log levels. An example being `etcdserver=WARNING,security=DEBUG`
+ default: none (INFO for all packages)
### Unsafe Flags ### Unsafe Flags
Please be CAUTIOUS when using unsafe flags because it will break the guarantees given by the consensus protocol. Please be CAUTIOUS when using unsafe flags because it will break the guarantees given by the consensus protocol.

View File

@ -96,8 +96,8 @@ type config struct {
clientTLSInfo, peerTLSInfo transport.TLSInfo clientTLSInfo, peerTLSInfo transport.TLSInfo
// logging // logging
debug bool debug bool
logPkgs string logPkgLevels string
// unsafe // unsafe
forceNewCluster bool forceNewCluster bool
@ -185,7 +185,7 @@ func NewConfig() *config {
// logging // logging
fs.BoolVar(&cfg.debug, "debug", false, "Enable debug output to the logs.") fs.BoolVar(&cfg.debug, "debug", false, "Enable debug output to the logs.")
fs.StringVar(&cfg.logPkgs, "log-packages", "", "Specify a particular log level for each etcd package.") fs.StringVar(&cfg.logPkgLevels, "log-package-levels", "", "Specify a particular log level for each etcd package.")
// unsafe // unsafe
fs.BoolVar(&cfg.forceNewCluster, "force-new-cluster", false, "Force to create a new one member cluster") fs.BoolVar(&cfg.forceNewCluster, "force-new-cluster", false, "Force to create a new one member cluster")

View File

@ -399,9 +399,9 @@ func setupLogging(cfg *config) {
if cfg.debug { if cfg.debug {
capnslog.SetGlobalLogLevel(capnslog.DEBUG) capnslog.SetGlobalLogLevel(capnslog.DEBUG)
} }
if cfg.logPkgs != "" { if cfg.logPkgLevels != "" {
repoLog := capnslog.MustRepoLogger("github.com/coreos/etcd") repoLog := capnslog.MustRepoLogger("github.com/coreos/etcd")
settings, err := repoLog.ParseLogLevelConfig(cfg.logPkgs) settings, err := repoLog.ParseLogLevelConfig(cfg.logPkgLevels)
if err != nil { if err != nil {
log.Warningf("Couldn't parse log level string: %s, continuing with default levels", err.Error()) log.Warningf("Couldn't parse log level string: %s, continuing with default levels", err.Error())
return return

View File

@ -96,6 +96,12 @@ security flags:
--peer-trusted-ca-file '' --peer-trusted-ca-file ''
path to the peer server TLS trusted CA file. path to the peer server TLS trusted CA file.
logging flags
--debug 'false'
enable debug-level logging for etcd.
--log-package-levels ''
set individual packages to various log levels (eg: 'etcdmain=CRITICAL,etcdserver=DEBUG')
unsafe flags: unsafe flags: