Skip to content

Commit

Permalink
Stop initializing the logger twice in dogstatsd (DataDog#31662)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgimalac authored Dec 3, 2024
1 parent be4b703 commit f32d2d4
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions cmd/dogstatsd/subcommands/start/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import (
"github.com/DataDog/datadog-agent/comp/metadata/runner"
metadatarunnerimpl "github.com/DataDog/datadog-agent/comp/metadata/runner/runnerimpl"
compressionfx "github.com/DataDog/datadog-agent/comp/serializer/compression/fx"
pkgconfigsetup "github.com/DataDog/datadog-agent/pkg/config/setup"
"github.com/DataDog/datadog-agent/pkg/serializer"
"github.com/DataDog/datadog-agent/pkg/status/health"
"github.com/DataDog/datadog-agent/pkg/util"
Expand Down Expand Up @@ -236,33 +235,6 @@ func RunDogstatsd(_ context.Context, cliParams *CLIParams, config config.Compone
}
}()

// Setup logger
syslogURI := pkglogsetup.GetSyslogURI(pkgconfigsetup.Datadog())
logFile := config.GetString("log_file")
if logFile == "" {
logFile = params.DefaultLogFile
}

if config.GetBool("disable_file_logging") {
// this will prevent any logging on file
logFile = ""
}

err = pkglogsetup.SetupLogger(
loggerName,
config.GetString("log_level"),
logFile,
syslogURI,
config.GetBool("syslog_rfc"),
config.GetBool("log_to_console"),
config.GetBool("log_format_json"),
pkgconfigsetup.Datadog(),
)
if err != nil {
log.Criticalf("Unable to setup logger: %s", err)
return
}

if err := util.SetupCoreDump(config); err != nil {
log.Warnf("Can't setup core dumps: %v, core dumps might not be available after a crash", err)
}
Expand Down

0 comments on commit f32d2d4

Please sign in to comment.