Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion logger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ logger.SetLoggerLevel("warn")

#### output to file

Add the file item under the logger option in the configuration file
Set `appender: file` and add the file item under the logger option in the configuration file. When the sample is run from `logger/rolling`, the relative file name below is created as `logger/rolling/logs.log`. Use `appender: console,file` if you want the same log records to be written to both console and file.

```yaml
logger:
appender: file
file:
Comment thread
Snow-kal marked this conversation as resolved.
name: logs.log
max-size: 1
Expand Down
3 changes: 2 additions & 1 deletion logger/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ logger.SetLoggerLevel("warn")

#### 输出到文件

在配置文件中的 logger 选项下添加 file
在配置文件中的 logger 选项下设置 `appender: file` 并添加 file 项。从 `logger/rolling` 目录运行样例时,下面的相对文件名会生成到 `logger/rolling/logs.log`。如果希望同一批日志同时输出到控制台和文件,可使用 `appender: console,file`。

```yaml
logger:
appender: file
file:
Comment thread
Snow-kal marked this conversation as resolved.
name: logs.log
max-size: 1
Expand Down
1 change: 1 addition & 0 deletions logger/rolling/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func main() {
logger.Info("hello dubbogo this is info log")
logger.Debug("hello dubbogo this is debug log")
logger.Warn("hello dubbogo this is warn log")
time.Sleep(time.Second * 1)
}
}
}
1 change: 1 addition & 0 deletions logger/rolling/conf/dubbogo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dubbo:
name: tri
port: 20000
logger:
appender: file
file:
name: logs.log
max-size: 1
Expand Down
Loading