diff --git a/changelog/unreleased/fix-revad-logging.md b/changelog/unreleased/fix-revad-logging.md new file mode 100644 index 0000000000..fa397da9f3 --- /dev/null +++ b/changelog/unreleased/fix-revad-logging.md @@ -0,0 +1,8 @@ +Bugfix: Do not truncate logs on restart + +This change fixes the way log files were opened. +Before they were truncated and now the log file +will be open in append mode and created it if it +does not exist. + +https://github.com/cs3org/reva/pull/2047 diff --git a/cmd/revad/runtime/runtime.go b/cmd/revad/runtime/runtime.go index 458caf401d..22d55eb30b 100644 --- a/cmd/revad/runtime/runtime.go +++ b/cmd/revad/runtime/runtime.go @@ -235,7 +235,7 @@ func getWriter(out string) (io.Writer, error) { return os.Stdout, nil } - fd, err := os.Create(out) + fd, err := os.OpenFile(out, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { err = errors.Wrap(err, "error creating log file: "+out) return nil, err