diff --git a/cmd/frpc/sub/root.go b/cmd/frpc/sub/root.go index bf86793..d7aa2de 100644 --- a/cmd/frpc/sub/root.go +++ b/cmd/frpc/sub/root.go @@ -138,7 +138,11 @@ func parseClientCommonCfg(fileType int, source []byte) (cfg config.ClientCommonC if err != nil { return } - + if cfg.LogFile == "console" { + cfg.LogWay = "console" + } else { + cfg.LogWay = "file" + } err = cfg.Check() if err != nil { return @@ -167,11 +171,6 @@ func parseClientCommonCfgFromCmd() (cfg config.ClientCommonConf, err error) { cfg.LogLevel = logLevel cfg.LogFile = logFile cfg.LogMaxDays = int64(logMaxDays) - if logFile == "console" { - cfg.LogWay = "console" - } else { - cfg.LogWay = "file" - } cfg.DisableLogColor = disableLogColor // Only token authentication is supported in cmd mode diff --git a/cmd/frps/root.go b/cmd/frps/root.go index b76817b..3bf2580 100644 --- a/cmd/frps/root.go +++ b/cmd/frps/root.go @@ -144,7 +144,11 @@ func parseServerCommonCfg(fileType int, source []byte) (cfg config.ServerCommonC if err != nil { return } - + if cfg.LogFile == "console" { + cfg.LogWay = "console" + } else { + cfg.LogWay = "file" + } err = cfg.Check() if err != nil { return @@ -190,12 +194,6 @@ func parseServerCommonCfgFromCmd() (cfg config.ServerCommonConf, err error) { } } cfg.MaxPortsPerClient = maxPortsPerClient - - if logFile == "console" { - cfg.LogWay = "console" - } else { - cfg.LogWay = "file" - } cfg.DisableLogColor = disableLogColor return }