Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions modules/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ func NewLogger(bufLen int64, mode, config string) {
}
}

// DelLogger removes loggers that are for the given mode
func DelLogger(mode string) error {
for _, l := range loggers {
if _, ok := l.outputs[mode]; ok {
return l.DelLogger(mode)
}
}
Trace("Log adapter %s not found, no need to delete", mode)
return nil
}

// NewGitLogger create a logger for git
// FIXME: use same log level as other loggers.
func NewGitLogger(logPath string) {
Expand Down
10 changes: 10 additions & 0 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,16 @@ func newLogService() {
LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
LogConfigs = make([]string, len(LogModes))

useConsole := false
for _, mode := range LogModes {
if mode == "console" {
useConsole = true
}
}
if (!useConsole) {
log.DelLogger("console")
}

for i, mode := range LogModes {
mode = strings.TrimSpace(mode)

Expand Down