diff --git a/cmd/launcher/svc_windows.go b/cmd/launcher/svc_windows.go index e007b68fb..c641f2af4 100644 --- a/cmd/launcher/svc_windows.go +++ b/cmd/launcher/svc_windows.go @@ -51,19 +51,21 @@ func runWindowsSvc(args []string) error { os.Exit(1) } - // Create a local logger. This logs to a known path, and aims to help diagnostics - if opts.RootDirectory != "" { - logger = teelogger.New(logger, locallogger.NewKitLogger(filepath.Join(opts.RootDirectory, "debug.json"))) - locallogger.CleanUpRenamedDebugLogs(opts.RootDirectory, logger) - } - - // Now that we've parsed the options, let's set a filter on our logger + // Now that we've parsed the options, let's set a filter on our eventLog logger. + // We don't want to set this on the teelogger below because we want debug logs to always + // go to debug.json. if opts.Debug { logger = level.NewFilter(logger, level.AllowDebug()) } else { logger = level.NewFilter(logger, level.AllowInfo()) } + // Create a local logger. This logs to a known path, and aims to help diagnostics + if opts.RootDirectory != "" { + logger = teelogger.New(logger, locallogger.NewKitLogger(filepath.Join(opts.RootDirectory, "debug.json"))) + locallogger.CleanUpRenamedDebugLogs(opts.RootDirectory, logger) + } + // Use the FindNewest mechanism to delete old // updates. We do this here, as windows will pick up // the update in main, which does not delete. Note