Skip to content

Commit

Permalink
address amber's comment
Browse files Browse the repository at this point in the history
  • Loading branch information
whitewum committed Nov 12, 2019
1 parent 0c5be42 commit 23e9b80
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# 日志

Nebula 使用 [glog](https://github.com/google/glog) 来打印日志,使用 gflag 来控制日志的级别,并提供 HTTP 接口来运行时动态的改变日志级别,以方便追踪问题。
Nebula 使用 [glog](https://github.com/google/glog) 来打印日志,使用 gflag 控制日志的级别,并提供 HTTP 接口在运行时动态改变日志级别,以方便追踪问题。

## 参数说明

### glog 中的两个主要参数

- minloglevel 0-4: 对应的日志级别分别为 INFO(DEBUG), WARING, ERROR, FATAL。通常在调试环境设置为 0,生产环境设置为1。
- minloglevel 0-4: 对应的日志级别分别为 INFO(DEBUG)WARINGERRORFATAL。通常在调试环境设置为 0,生产环境设置为1。
- v 0-4: 当 minloglevel 设置为 0 时,可以进一步设置调试日志的详细程度,值越大越详细。

### 配置文件

配置文件中(通常在 `/usr/local/nebula/etc/`)可以找到 metad, graphd, storaged 的日志默认配置级别。
配置文件中通常在 `/usr/local/nebula/etc/`可以找到 metadgraphdstoraged 的日志默认配置级别。

## 动态查看和修改日志级别

可以通过如下命令来查看当前的所有的 gflags 参数(包括日志参数)

```sh
```bash
> curl ${ws_ip}:${ws_port}/get_flags
```

Expand All @@ -27,19 +27,19 @@ Nebula 使用 [glog](https://github.com/google/glog) 来打印日志,使用 gf

例如,查看 storaged 的 minloglevel 级别:

```sh
```bash
> curl 127.0.0.1:12000/get_flags | grep minloglevel
```

也可以通过如下命令将日志级别更改为**最详细**

```sh
```bash
> curl "http://127.0.0.1:12000/set_flags?flag=v&value=4"
> curl "http://127.0.0.1:12000/set_flags?flag=minloglevel&value=0"
```

或者**关闭** 所有的日志打印(仅保留 FATAL)
或者**关闭**所有的日志打印(仅保留 FATAL)

```sh
```bash
> curl "http://127.0.0.1:12000/set_flags?flag=minloglevel&value=4"
```

0 comments on commit 23e9b80

Please sign in to comment.