Commit 0e18eafc by Torkel Ödegaard

Merge pull request #2535 from raintank/logging

close all existing loggers before re-initializing loggers. fixes #2533
parents ad1fa110 c138f390
...@@ -82,7 +82,11 @@ func Fatal(skip int, format string, v ...interface{}) { ...@@ -82,7 +82,11 @@ func Fatal(skip int, format string, v ...interface{}) {
func Close() { func Close() {
for _, l := range loggers { for _, l := range loggers {
l.Close() l.Close()
// delete the logger.
l = nil
} }
// clear the loggers slice.
loggers = nil
} }
// .___ __ _____ // .___ __ _____
......
...@@ -456,6 +456,8 @@ var logLevels = map[string]int{ ...@@ -456,6 +456,8 @@ var logLevels = map[string]int{
} }
func initLogging(args *CommandLineArgs) { func initLogging(args *CommandLineArgs) {
//close any existing log handlers.
log.Close()
// Get and check log mode. // Get and check log mode.
LogModes = strings.Split(Cfg.Section("log").Key("mode").MustString("console"), ",") LogModes = strings.Split(Cfg.Section("log").Key("mode").MustString("console"), ",")
LogsPath = makeAbsolute(Cfg.Section("paths").Key("logs").String(), HomePath) LogsPath = makeAbsolute(Cfg.Section("paths").Key("logs").String(), HomePath)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment