etcd 日志级别

先补充一个知识点,etcd 有7钟日志级别,如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const (  
// CRITICAL is the lowest log level; only errors which will end the program will be propagated.
CRITICAL LogLevel = iota - 1
// ERROR is for errors that are not fatal but lead to troubling behavior.
ERROR
// WARNING is for errors which are not fatal and not errors, but are unusual. Often sourced from misconfigurations.
WARNING
// NOTICE is for normal but significant conditions.
NOTICE
// INFO is a log level for common, everyday log updates.
INFO
// DEBUG is the default hidden level for more verbose updates about internal processes.
DEBUG
// TRACE is for (potentially) call by call tracing of programs.
TRACE
)

代码中解释的很直观,而在具体日志中,都是以缩写的形式显示,如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
switch l {  
case CRITICAL:
return "C"
case ERROR:
return "E"
case WARNING:
return "W"
case NOTICE:
return "N"
case INFO:
return "I"
case DEBUG:
return "D"
case TRACE:
return "T"
default:
panic("Unhandled loglevel")
}

DEBUG 级别的日志,需要在 etcd 启动时设置参数打开,通常输出都是 INFO 以上的级别日志,而我们重点要关注的就是 WARNING 、 ERROR 和 CRITICAL 这三种。