Skip to content

Commit

Permalink
to files check
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpristas committed Mar 10, 2021
1 parent 19a60f0 commit db1a3dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion libbeat/logp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ const defaultLevel = InfoLevel
// Beat is supposed to be run within.
func DefaultConfig(environment Environment) Config {
return Config{
Level: defaultLevel,
Level: defaultLevel,
ToFiles: true,
Files: FileConfig{
MaxSize: 10 * 1024 * 1024,
MaxBackups: 7,
Expand Down
17 changes: 11 additions & 6 deletions x-pack/elastic-agent/pkg/core/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,18 @@ func new(name string, cfg *Config) (*Logger, error) {
if err != nil {
return nil, err
}
internal, err := makeInternalFileOutput(cfg)
if err != nil {
return nil, err
}
if err := configure.LoggingWithOutputs("", commonCfg, internal); err != nil {
return nil, fmt.Errorf("error initializing logging: %v", err)

if cfg.ToFiles {
internal, err := makeInternalFileOutput(cfg)
if err != nil {
return nil, err
}

if err := configure.LoggingWithOutputs("", commonCfg, internal); err != nil {
return nil, fmt.Errorf("error initializing logging: %v", err)
}
}

return logp.NewLogger(name), nil
}

Expand Down

0 comments on commit db1a3dc

Please sign in to comment.