Browse Source

etcdmain: fix logging flag documentation

Barak Michener 10 years ago
parent
commit
ad8e3ea5dc
4 changed files with 24 additions and 7 deletions
  1. 11 0
      Documentation/configuration.md
  2. 3 3
      etcdmain/config.go
  3. 2 2
      etcdmain/etcd.go
  4. 8 2
      etcdmain/help.go

+ 11 - 0
Documentation/configuration.md

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

+ 3 - 3
etcdmain/config.go

@@ -96,8 +96,8 @@ type config struct {
 	clientTLSInfo, peerTLSInfo transport.TLSInfo
 	clientTLSInfo, peerTLSInfo transport.TLSInfo
 
 
 	// logging
 	// logging
-	debug   bool
-	logPkgs string
+	debug        bool
+	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")

+ 2 - 2
etcdmain/etcd.go

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

+ 8 - 2
etcdmain/help.go

@@ -48,7 +48,7 @@ member flags:
 clustering flags:
 clustering flags:
 
 
 	--initial-advertise-peer-urls 'http://localhost:2380,http://localhost:7001'
 	--initial-advertise-peer-urls 'http://localhost:2380,http://localhost:7001'
-		list of this member's peer URLs to advertise to the rest of the cluster. 
+		list of this member's peer URLs to advertise to the rest of the cluster.
 	--initial-cluster 'default=http://localhost:2380,default=http://localhost:7001'
 	--initial-cluster 'default=http://localhost:2380,default=http://localhost:7001'
 		initial cluster configuration for bootstrapping.
 		initial cluster configuration for bootstrapping.
 	--initial-cluster-state 'new'
 	--initial-cluster-state 'new'
@@ -96,12 +96,18 @@ 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:
 
 
 Please be CAUTIOUS when using unsafe flags because it will break the guarantees
 Please be CAUTIOUS when using unsafe flags because it will break the guarantees
 given by the consensus protocol.
 given by the consensus protocol.
-	
+
 	--force-new-cluster 'false'
 	--force-new-cluster 'false'
 		force to create a new one-member cluster.
 		force to create a new one-member cluster.
 `
 `