Skip to content

Commit

Permalink
fix(logger): Avoid setting the log-format default too early (#16108)
Browse files Browse the repository at this point in the history
(cherry picked from commit 5793ff6)
  • Loading branch information
srebhan committed Nov 18, 2024
1 parent 776391c commit a4dae7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ func NewConfig() *Config {
Interval: Duration(10 * time.Second),
RoundInterval: true,
FlushInterval: Duration(10 * time.Second),
LogFormat: "text",
LogfileRotationMaxArchives: 5,
},

Expand Down
4 changes: 4 additions & 0 deletions logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ func SetupLogging(cfg *Config) error {
return fmt.Errorf("invalid deprecated 'logtarget' setting %q", cfg.LogTarget)
}

if cfg.LogFormat == "" {
cfg.LogFormat = "text"
}

if cfg.Debug {
cfg.logLevel = telegraf.Debug
}
Expand Down

0 comments on commit a4dae7a

Please sign in to comment.