Skip to content

Commit

Permalink
disable console output xorm log on ssh (#993)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Feb 21, 2017
1 parent ffde33b commit 70ae6d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,6 @@ func newLogService() {

for i, mode := range LogModes {
sec, err := Cfg.GetSection("log." + mode)

if err != nil {
sec, _ = Cfg.NewSection("log." + mode)
}
Expand Down Expand Up @@ -1025,9 +1024,10 @@ func NewXORMLogService(disableConsole bool) {
if disableConsole && mode == "console" {
continue
}

sec, err := Cfg.GetSection("log." + mode)
if err != nil {
log.Fatal(4, "Unknown log mode: %s", mode)
sec, _ = Cfg.NewSection("log." + mode)
}

validLevels := []string{"Trace", "Debug", "Info", "Warn", "Error", "Critical"}
Expand Down Expand Up @@ -1079,7 +1079,9 @@ func NewXORMLogService(disableConsole bool) {
}

log.NewXORMLogger(Cfg.Section("log").Key("BUFFER_LEN").MustInt64(10000), mode, logConfigs)
log.Info("XORM Log Mode: %s(%s)", strings.Title(mode), levelName)
if !disableConsole {
log.Info("XORM Log Mode: %s(%s)", strings.Title(mode), levelName)
}

var lvl core.LogLevel
switch levelName {
Expand Down

0 comments on commit 70ae6d1

Please sign in to comment.