fix(logger): Avoid setting the log-format default too early (#16108)
This commit is contained in:
parent
f8b2b0a914
commit
5793ff6366
|
|
@ -123,7 +123,6 @@ func NewConfig() *Config {
|
||||||
Interval: Duration(10 * time.Second),
|
Interval: Duration(10 * time.Second),
|
||||||
RoundInterval: true,
|
RoundInterval: true,
|
||||||
FlushInterval: Duration(10 * time.Second),
|
FlushInterval: Duration(10 * time.Second),
|
||||||
LogFormat: "text",
|
|
||||||
LogfileRotationMaxArchives: 5,
|
LogfileRotationMaxArchives: 5,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,10 @@ func SetupLogging(cfg *Config) error {
|
||||||
return fmt.Errorf("invalid deprecated 'logtarget' setting %q", cfg.LogTarget)
|
return fmt.Errorf("invalid deprecated 'logtarget' setting %q", cfg.LogTarget)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.LogFormat == "" {
|
||||||
|
cfg.LogFormat = "text"
|
||||||
|
}
|
||||||
|
|
||||||
if cfg.Debug {
|
if cfg.Debug {
|
||||||
cfg.logLevel = telegraf.Debug
|
cfg.logLevel = telegraf.Debug
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue