Skip to content

Commit

Permalink
config: Add log configuration items to the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSupeng committed Jun 29, 2021
1 parent 964cadb commit 4c06a8f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
30 changes: 15 additions & 15 deletions cmd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ func (s *serverSuite) TestLoadAndVerifyServerConfig(c *check.C) {
cfg, err = loadAndVerifyServerConfig(cmd)
c.Assert(err, check.IsNil)
c.Assert(cfg, check.DeepEquals, &config.ServerConfig{
Addr: "127.5.5.1:8833",
AdvertiseAddr: "127.5.5.1:7777",
LogFile: "/root/cdc.log",
LogLevel: "debug",
Addr: "127.5.5.1:8833",
AdvertiseAddr: "127.5.5.1:7777",
LogFile: "/root/cdc.log",
LogLevel: "debug",
Log: &config.LogConfig{
File:&config.LogFileConfig{
File: &config.LogFileConfig{
MaxSize: 300,
MaxDays: 0,
MaxBackups: 0,
Expand Down Expand Up @@ -202,12 +202,12 @@ sort-dir = "/tmp/just_a_test"
cfg, err = loadAndVerifyServerConfig(cmd)
c.Assert(err, check.IsNil)
c.Assert(cfg, check.DeepEquals, &config.ServerConfig{
Addr: "128.0.0.1:1234",
AdvertiseAddr: "127.0.0.1:1111",
LogFile: "/root/cdc1.log",
LogLevel: "warn",
Addr: "128.0.0.1:1234",
AdvertiseAddr: "127.0.0.1:1111",
LogFile: "/root/cdc1.log",
LogLevel: "warn",
Log: &config.LogConfig{
File:&config.LogFileConfig{
File: &config.LogFileConfig{
MaxSize: 200,
MaxDays: 1,
MaxBackups: 1,
Expand Down Expand Up @@ -266,12 +266,12 @@ cert-allowed-cn = ["dd","ee"]
cfg, err = loadAndVerifyServerConfig(cmd)
c.Assert(err, check.IsNil)
c.Assert(cfg, check.DeepEquals, &config.ServerConfig{
Addr: "127.5.5.1:8833",
AdvertiseAddr: "127.0.0.1:1111",
LogFile: "/root/cdc.log",
LogLevel: "debug",
Addr: "127.5.5.1:8833",
AdvertiseAddr: "127.0.0.1:1111",
LogFile: "/root/cdc.log",
LogLevel: "debug",
Log: &config.LogConfig{
File:&config.LogFileConfig{
File: &config.LogFileConfig{
MaxSize: 200,
MaxDays: 1,
MaxBackups: 1,
Expand Down
8 changes: 4 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ var defaultServerConfig = &ServerConfig{
LogFile: "",
LogLevel: "info",
Log: &LogConfig{
File:&LogFileConfig{
File: &LogFileConfig{
MaxSize: 300,
MaxDays: 0,
MaxBackups: 0,
},
},
DataDir: "",
GcTTL: 24 * 60 * 60, // 24H
TZ: "System",
DataDir: "",
GcTTL: 24 * 60 * 60, // 24H
TZ: "System",
// The default election-timeout in PD is 3s and minimum session TTL is 5s,
// which is calculated by `math.Ceil(3 * election-timeout / 2)`, we choose
// default capture session ttl to 10s to increase robust to PD jitter,
Expand Down

0 comments on commit 4c06a8f

Please sign in to comment.