Merge pull request #1525 from travisturner/startup-log-dir

[CORE-362] Create the data directory during "log startup" if it doesn't already exist
This commit is contained in:
Travis Turner 2021-03-12 06:47:45 -06:00 committed by GitHub
commit 81c47b778e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1478,6 +1478,10 @@ func (h *Holder) logStartup() error {
time := time.Now().Format(RFC3339NanoFixedWidth)
logLine := fmt.Sprintf("%s\t%s\n", time, Version)
if err := os.MkdirAll(h.path, 0777); err != nil {
return errors.Wrap(err, "creating data directory")
}
f, err := os.OpenFile(h.path+"/startup.log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
return errors.Wrap(err, "opening startup log")