Skip to content

Commit

Permalink
Ensure debug logs are written to debug.json on Windows (kolide#1381)
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany authored Oct 4, 2023
1 parent 4df0fd3 commit ebbf392
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cmd/launcher/svc_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ebbf392

Please sign in to comment.