I execute the process with Go and write the output to a file (log file)
cmd := exec.Command(path) cmd.Dir = dir t := time.Now() t1 := t.Format("20060102-150405") fs, err := os.Create(dir + "/var/log/" + t1 + ".std") if err == nil { cmd.Stdout = fs }
I want to rotate the logs and change the log file daily http://golang.org/pkg/os/exec/
Is it safe to change the cmd.Stdout variable daily from arbitary goroutine or do I need to implement a goroutine that will copy from Stdout to another file and switch files?
go exec
Andrew
source share