From 391facbedf8054945f34040a32343e259d9578d8 Mon Sep 17 00:00:00 2001 From: Nuno Diegues Date: Thu, 14 Jan 2021 11:53:35 +0000 Subject: [PATCH] TUN-3756: File logging output must consider the directory --- logger/create.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/logger/create.go b/logger/create.go index 3a1191de..e126ed99 100644 --- a/logger/create.go +++ b/logger/create.go @@ -5,6 +5,7 @@ import ( "io" "os" "path" + "path/filepath" "github.com/mattn/go-colorable" "github.com/rs/zerolog" @@ -159,7 +160,8 @@ func createLogFile(config FileConfig) (io.Writer, error) { mode := os.FileMode(filePermMode) - logFile, err := os.OpenFile(config.Filename, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode) + fullPath := filepath.Join(config.Dirname, config.Filename) + logFile, err := os.OpenFile(fullPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode) if err != nil { return nil, fmt.Errorf("unable to create a new logfile: %s", err) }