fix: use log.file=eventlog as default value, if running as windows service (#1771)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2024-11-26 21:46:54 +01:00
committed by GitHub
parent fd55ac4894
commit ca04ad8fd2
5 changed files with 23 additions and 9 deletions

View File

@@ -105,7 +105,14 @@ func run() int {
).Default("normal").String()
)
logConfig := &log.Config{}
logFile := &log.AllowedFile{}
_ = logFile.Set("stdout")
if windowsservice.IsService {
_ = logFile.Set("eventlog")
}
logConfig := &log.Config{File: logFile}
flag.AddFlags(app, logConfig)
app.Version(version.Print("windows_exporter"))