From c9090b8a112c83197d814ce3ad26dda32b03965b Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Mon, 2 Mar 2020 14:06:54 -0700 Subject: [PATCH] [FIXED] Windows Service: do not force usage of syslog When starting as a Windows Service, we were creating a syslog to possibly log the failure to start. But users running without admin privileges would be unable to use the service since the server would fail to create the event log entry. So create the syslog only if explicit set (-syslog option) or if no logfile has been specified. Signed-off-by: Ivan Kozlovic --- nats-streaming-server.go | 2 +- server/service_windows.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nats-streaming-server.go b/nats-streaming-server.go index ff132c4e..5b204f2e 100644 --- a/nats-streaming-server.go +++ b/nats-streaming-server.go @@ -115,7 +115,7 @@ Embedded NATS Server Options: Logging Options: -l, --log File to redirect log output -T, --logtime= Timestamp log entries (default: true) - -s, --syslog Enable syslog as log method + -s, --syslog Enable syslog as log method -r, --remote_syslog Syslog server addr (udp://localhost:514) -D, --debug= Enable debugging output -V, --trace= Trace the raw protocol diff --git a/server/service_windows.go b/server/service_windows.go index 3d57116c..24b04a9a 100644 --- a/server/service_windows.go +++ b/server/service_windows.go @@ -131,7 +131,7 @@ func Run(sOpts *Options, nOpts *natsd.Options) (*StanServer, error) { } if isInteractive { run = debug.Run - } else { + } else if nOpts.Syslog || nOpts.LogFile == "" { sysLogInitLock.Lock() // We create a syslog here because we want to capture possible startup // failure message.