From 3b788c90addd9be12e9f755a4a600edda2f44fe8 Mon Sep 17 00:00:00 2001 From: Pierre Gimalac Date: Fri, 13 Dec 2024 14:57:34 +0100 Subject: [PATCH] Remove EnableLoggingToFile function on Windows (#31882) --- cmd/agent/common/common_windows.go | 15 --------------- cmd/agent/main_windows.go | 2 -- cmd/iot-agent/main_windows.go | 2 -- 3 files changed, 19 deletions(-) diff --git a/cmd/agent/common/common_windows.go b/cmd/agent/common/common_windows.go index 33d215dccc84a6..b3c84d6c660357 100644 --- a/cmd/agent/common/common_windows.go +++ b/cmd/agent/common/common_windows.go @@ -9,9 +9,6 @@ import ( "os" "path/filepath" - //nolint:depguard // creating a logger from a seelog config - "github.com/cihub/seelog" - pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup" "github.com/DataDog/datadog-agent/pkg/util/defaultpaths" "github.com/DataDog/datadog-agent/pkg/util/log" @@ -29,18 +26,6 @@ func init() { } } -// EnableLoggingToFile -- set up logging to file -func EnableLoggingToFile() { - seeConfig := ` - - - - -` - logger, _ := seelog.LoggerFromConfigAsBytes([]byte(seeConfig)) - log.ReplaceLogger(logger) -} - // CheckAndUpgradeConfig checks to see if there's an old datadog.conf, and if // datadog.yaml is either missing or incomplete (no API key). If so, upgrade it func CheckAndUpgradeConfig() error { diff --git a/cmd/agent/main_windows.go b/cmd/agent/main_windows.go index bf4fc6e032a3f6..389d880cf50dae 100644 --- a/cmd/agent/main_windows.go +++ b/cmd/agent/main_windows.go @@ -11,7 +11,6 @@ import ( "os" "github.com/DataDog/datadog-agent/cmd/agent/command" - "github.com/DataDog/datadog-agent/cmd/agent/common" "github.com/DataDog/datadog-agent/cmd/agent/subcommands" "github.com/DataDog/datadog-agent/cmd/agent/windows/service" "github.com/DataDog/datadog-agent/cmd/internal/runcmd" @@ -20,7 +19,6 @@ import ( ) func main() { - common.EnableLoggingToFile() // if command line arguments are supplied, even in a non interactive session, // then just execute that. Used when the service is executing the executable, // for instance to trigger a restart. diff --git a/cmd/iot-agent/main_windows.go b/cmd/iot-agent/main_windows.go index b7a9183b4bcb77..a53048ea9a1002 100644 --- a/cmd/iot-agent/main_windows.go +++ b/cmd/iot-agent/main_windows.go @@ -12,7 +12,6 @@ import ( "os" "github.com/DataDog/datadog-agent/cmd/agent/command" - "github.com/DataDog/datadog-agent/cmd/agent/common" "github.com/DataDog/datadog-agent/cmd/agent/subcommands" "github.com/DataDog/datadog-agent/cmd/agent/windows/service" "github.com/DataDog/datadog-agent/pkg/util/flavor" @@ -24,7 +23,6 @@ func main() { // set the Agent flavor flavor.SetFlavor(flavor.IotAgent) - common.EnableLoggingToFile() // if command line arguments are supplied, even in a non interactive session, // then just execute that. Used when the service is executing the executable, // for instance to trigger a restart.