Skip to content

Commit

Permalink
Logger: pre-create log files before lumberjack does
Browse files Browse the repository at this point in the history
Clunky workaround for natefinch/lumberjack#164
  • Loading branch information
jedisct1 committed Feb 25, 2023
1 parent 03c6f92 commit 47e6a56
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dnscrypt-proxy/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ func Logger(logMaxSize int, logMaxAge int, logMaxBackups int, fileName string) i
}
return fp
}
if fp, err := os.OpenFile(fileName, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0o644); err == nil {
fp.Close()
} else {
dlog.Errorf("Unable to create [%v]: [%v]", fileName, err)
}
logger := &lumberjack.Logger{
LocalTime: true,
MaxSize: logMaxSize,
Expand Down

0 comments on commit 47e6a56

Please sign in to comment.