Skip to content

Commit

Permalink
Merge 1e700d0 into backport/agent-syslog-log-level/lively-profound-co…
Browse files Browse the repository at this point in the history
…llie
  • Loading branch information
hc-github-team-nomad-core committed Jan 4, 2023
2 parents 637b841 + 1e700d0 commit 0f127c2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions command/agent/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,20 +472,21 @@ func SetupLoggers(ui cli.Ui, config *Config) (*logutils.LevelFilter, *gatedwrite

// Create a log writer, and wrap a logOutput around it
writers := []io.Writer{logFilter}
logLevel := strings.ToUpper(config.LogLevel)
logLevelMap := map[string]gsyslog.Priority{
"ERROR": gsyslog.LOG_ERR,
"WARN": gsyslog.LOG_WARNING,
"INFO": gsyslog.LOG_INFO,
"DEBUG": gsyslog.LOG_DEBUG,
"TRACE": gsyslog.LOG_DEBUG,
}
if config.LogLevel == "OFF" {
if logLevel == "OFF" {
config.EnableSyslog = false
}
// Check if syslog is enabled
if config.EnableSyslog {
ui.Output(fmt.Sprintf("Config enable_syslog is `true` with log_level=%v", config.LogLevel))
l, err := gsyslog.NewLogger(logLevelMap[config.LogLevel], config.SyslogFacility, "nomad")
l, err := gsyslog.NewLogger(logLevelMap[logLevel], config.SyslogFacility, "nomad")
if err != nil {
ui.Error(fmt.Sprintf("Syslog setup failed: %v", err))
return nil, nil, nil
Expand Down

0 comments on commit 0f127c2

Please sign in to comment.