Append to debug log files, don't clobber.

This commit is contained in:
Sean Chittenden 2016-10-18 13:08:23 -07:00
parent 6d1e7ab1eb
commit b1c3649eac
No known key found for this signature in database
GPG Key ID: 4EBC9DC16C2E5E16

View File

@ -6,6 +6,7 @@ import (
"log" "log"
"os" "os"
"strings" "strings"
"syscall"
"github.com/hashicorp/logutils" "github.com/hashicorp/logutils"
) )
@ -31,7 +32,7 @@ func LogOutput() (logOutput io.Writer, err error) {
logOutput = os.Stderr logOutput = os.Stderr
if logPath := os.Getenv(EnvLogFile); logPath != "" { if logPath := os.Getenv(EnvLogFile); logPath != "" {
var err error var err error
logOutput, err = os.Create(logPath) logOutput, err = os.OpenFile(logPath, syscall.O_CREAT|syscall.O_RDWR|syscall.O_APPEND, 0666)
if err != nil { if err != nil {
return nil, err return nil, err
} }