summaryrefslogtreecommitdiff
path: root/pkg/config/logger.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/config/logger.go')
-rw-r--r--pkg/config/logger.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/config/logger.go b/pkg/config/logger.go
index cb78349..cc7a4f6 100644
--- a/pkg/config/logger.go
+++ b/pkg/config/logger.go
@@ -25,9 +25,13 @@ import (
//ConfigureLogger to write logs into a file as well as the stderr
func ConfigureLogger(logPath string) (io.Closer, error) {
dir := path.Dir(logPath)
- err := os.MkdirAll(dir, 0700)
- if err == nil {
- log.Println("ERROR: cannot create data dir")
+ if _, err := os.Stat(dir); err != nil {
+ if os.IsNotExist(err) {
+ err := os.MkdirAll(dir, 0700)
+ if err == nil {
+ log.Println("ERROR: cannot create data dir")
+ }
+ }
}
logFile, err := os.OpenFile(logPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err == nil {