aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/xdsconfig/config.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/xdsconfig/config.go b/lib/xdsconfig/config.go
index ef94f0a..16390ae 100644
--- a/lib/xdsconfig/config.go
+++ b/lib/xdsconfig/config.go
@@ -112,11 +112,18 @@ func Init(ctx *cli.Context, log *logrus.Logger) (*Config, error) {
// Handle where Logs are redirected:
// default 'stdout' (logfile option default value)
// else use file (or filepath) set by --logfile option
- // that may be overwritten by LogsDir field of config file
+ // else use LogsDir field of config file
logF := c.Options.LogFile
logD := c.FileConf.LogsDir
if logF != "stdout" {
- if logD != "" {
+ if logF != "" {
+ if common.IsDir(logF) {
+ logD = logF
+ logF = filepath.Join(logF, "xds-agent.log")
+ } else {
+ logD = filepath.Dir(logF)
+ }
+ } else if logD != "" {
lf := filepath.Base(logF)
if lf == "" || lf == "." {
lf = "xds-agent.log"