Commit Graph

16 Commits (3ffb3aed3a8f544da02fac84b12367820c90ee7c)

Author SHA1 Message Date
jingyih 725e09023a *: set zap as default logger, remove capnslog
Set zap as default logger. Remove capnslog and deprecated logging
flags.
2020-02-04 04:57:49 -08:00
chris e8660c0cec embed: expose ZapLoggerBuilder
This exposes the ZapLoggerBuilder in the embed.Config to allow for
custom loggers to be defined and used by embedded etcd.

Fixes #11144
2019-09-13 07:46:01 -04:00
Gyuho Lee f22c7c80c1 embed: fix "--log-outputs" setup without "stderr"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-26 22:45:48 -07:00
Gyuho Lee b9de4bddda embed: add "LogLevel", deprecate "Debug" in v3.5
Make log level configurable, and deprecate "debug" flag in v3.5.
And adds more warnings on flags that's being deprecated in v3.5.

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-29 15:43:19 -07:00
Gyuho Lee 348b0d40a6 embed: do not expose "zapLoggerBuilder"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-29 15:43:19 -07:00
chris 2223142685 embed: fix oob panic in zap logger
This fixes an index out-of-bounds panic caused when using the embed
package and the zap logger. When a TLS handshake error is logged, the
slice for cert ip addresses is allocated with capacity but no length, so
subsequent index access causes the panic, and doesn't surface the TLS
handshake error to the user.

Fixes #10932
2019-07-25 09:42:42 -04:00
Gyuho Lee 34bd797e67 *: revert module import paths
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-05-28 15:39:35 -07:00
shivaramr 9150bf52d6 go modules: Fix module path version to include version number 2019-04-26 15:29:50 -07:00
Gyuho Lee 8d1a62e7ef *: use default log configuration for server
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-02-21 10:57:26 -08:00
Mark McLoughlin fcc29894c2 config: multiple logging fixes
First, don't panic with invalid --log-outputs. For example:

  $> ./bin/etcd --log-outputs foo
  2018-12-20 15:05:47.988652 C | embed: unknown log-output "foo" (only supports "default", "stderr", "stdout")
  panic: unknown log-output "foo" (only supports "default", "stderr", "stdout")

  goroutine 1 [running]:
  go.etcd.io/etcd/vendor/github.com/coreos/pkg/capnslog.(*PackageLogger).Panicf(0xc000294b00, 0x10fe067, 0x30, 0xc0001fa398, 0x4, 0x4)
        go.etcd.io/etcd/vendor/github.com/coreos/pkg/capnslog/pkg_logger.go:75 +0x161
  go.etcd.io/etcd/embed.(*Config).setupLogging(0xc000291400, 0xc0002a85b0, 0x1)
        go.etcd.io/etcd/embed/config_logging.go:120 +0x1939
  ...

Or:

 $> ./bin/etcd --log-outputs foo,default --logger zap
 panic: multi logoutput for "default" is not supported yet

 goroutine 1 [running]:
 go.etcd.io/etcd/embed.(*Config).setupLogging(0xc000314500, 0xc0001b2f70, 0x1)
        go.etcd.io/etcd/embed/config_logging.go:129 +0x2437
 go.etcd.io/etcd/embed.(*Config).Validate(0xc000314500, 0xc000268a98, 0x127e440)
        go.etcd.io/etcd/embed/config.go:543 +0x43

Second, don't exit in embed.setupLogging(). Before:

  $> ./bin/etcd --log-outputs foo,bar
  --logger=capnslog supports only 1 value in '--log-outputs', got ["bar" "foo"]

and after:

  $> ./bin/etcd --log-outputs foo,bar
  2018-12-20 15:10:24.317982 E | etcdmain: error verifying flags, --logger=capnslog supports only 1 value in '--log-outputs', got ["bar" "foo"]. See 'etcd --help'.

Third, remove duplicated unique strings code. UniqueStringsFromFlag()
is already available to return a sorted slice of values, so just use
that.

Lastly, fix a tiny logging typo in config.
2019-01-17 15:09:26 -05:00
nolouch ac090fe326 embed: add zap logger builder
Signed-off-by: nolouch <nolouch@gmail.com>
2019-01-15 23:22:04 +08:00
caoming 6744c57de3 embed: set log-outputs 'default' to 'stderr' config when zap mode 2018-12-06 09:33:51 +08:00
Gyuho Lee d37f1521b7 *: update import paths to "go.etcd.io/etcd"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2018-08-28 17:47:55 -07:00
Gyuho Lee 15fcd6d599 embed: do not support "--log-outputs=default" for zap logger
systemd/journal should be configured manually.
Interpreting PPID 1 as systemd unit is wrong,
especially when embedded etcd runs under Docker
container. For such case, every single log write
will error and fall back to stderr, which is
inefficient.

Instead, add "systemd/journal" log output option
and returns error if systemd/journal socket cannot
be found.

"--logger=zap --log-outputs=default" will only error
for v3.4, since zap logger is still experimental.

v3.5 deprecates capnslog and changes "--log-outputs"
default value to "--log-outputs=stderr".

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-16 14:47:43 -07:00
Gyuho Lee 5a61dc8008 embed: error when it cannot find journal socket
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-05-16 14:35:11 -07:00
Gyuho Lee c316e6773b embed: clean up structured logging calls
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
2018-04-26 14:36:22 -07:00