diff --git a/README.md b/README.md index 4d351a5..a06a5dd 100644 --- a/README.md +++ b/README.md @@ -217,10 +217,11 @@ examples of the appropriate syntax. i.e. in the current wrorking directory). Note that all intermediate directories must exist, Molly Brown won't create them for you. Set to `-` for logging to `stdout`. -* `ErrorLog`: Path to error log file (default value `error.log`, i.e. - in the current wrorking directory). Note that all intermediate - directories must exist, Molly Brown won't create them for you. Set - to `-` for logging to `stdout`. +* `ErrorLog`: Path to error log file. If set to an empty string (the + default), Molly Brown will log errors to stderr (where they are + easily captured by systemd or similar init systems). If set to a + file, note that all intermediate directories must exist, Molly Brown + won't create them for you. * `GeminiExt`: Files with this extension will be served with a MIME type of `text/gemini` (default value `gmi`). * `MimeOverrides`: In this section of the config file, keys are path diff --git a/config.go b/config.go index 74518ea..0d3fab4 100644 --- a/config.go +++ b/config.go @@ -63,7 +63,7 @@ func getConfig(filename string) (Config, error) { config.DefaultLang = "" config.DefaultEncoding = "" config.AccessLog = "access.log" - config.ErrorLog = "error.log" + config.ErrorLog = "" config.TempRedirects = make(map[string]string) config.PermRedirects = make(map[string]string) config.CGIPaths = make([]string, 0) diff --git a/main.go b/main.go index fcd93be..6725f14 100644 --- a/main.go +++ b/main.go @@ -40,8 +40,8 @@ func main() { // Open log files var errorLogFile *os.File - if config.ErrorLog == "-" { - errorLogFile = os.Stdout + if config.ErrorLog == "" { + errorLogFile = os.Stderr } else { errorLogFile, err = os.OpenFile(config.ErrorLog, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil {