Fix log_file does not work in config files (#2316)

This commit is contained in:
Splash 2021-03-22 11:30:12 +08:00 committed by GitHub
parent fa0e84382e
commit 6b80861bd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 13 deletions

View File

@ -138,7 +138,11 @@ func parseClientCommonCfg(fileType int, source []byte) (cfg config.ClientCommonC
if err != nil { if err != nil {
return return
} }
if cfg.LogFile == "console" {
cfg.LogWay = "console"
} else {
cfg.LogWay = "file"
}
err = cfg.Check() err = cfg.Check()
if err != nil { if err != nil {
return return
@ -167,11 +171,6 @@ func parseClientCommonCfgFromCmd() (cfg config.ClientCommonConf, err error) {
cfg.LogLevel = logLevel cfg.LogLevel = logLevel
cfg.LogFile = logFile cfg.LogFile = logFile
cfg.LogMaxDays = int64(logMaxDays) cfg.LogMaxDays = int64(logMaxDays)
if logFile == "console" {
cfg.LogWay = "console"
} else {
cfg.LogWay = "file"
}
cfg.DisableLogColor = disableLogColor cfg.DisableLogColor = disableLogColor
// Only token authentication is supported in cmd mode // Only token authentication is supported in cmd mode

View File

@ -144,7 +144,11 @@ func parseServerCommonCfg(fileType int, source []byte) (cfg config.ServerCommonC
if err != nil { if err != nil {
return return
} }
if cfg.LogFile == "console" {
cfg.LogWay = "console"
} else {
cfg.LogWay = "file"
}
err = cfg.Check() err = cfg.Check()
if err != nil { if err != nil {
return return
@ -190,12 +194,6 @@ func parseServerCommonCfgFromCmd() (cfg config.ServerCommonConf, err error) {
} }
} }
cfg.MaxPortsPerClient = maxPortsPerClient cfg.MaxPortsPerClient = maxPortsPerClient
if logFile == "console" {
cfg.LogWay = "console"
} else {
cfg.LogWay = "file"
}
cfg.DisableLogColor = disableLogColor cfg.DisableLogColor = disableLogColor
return return
} }