Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop initializing the logger twice in dogstatsd #31662

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading