From 1c9993f185906fcde01990864c6d453ba4462140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 14 May 2015 10:15:46 +0200 Subject: [PATCH] Backend configuration: When unknown key was detected the log error was not visible in log file due to logging was initialized after user config file is loaded, logging is now initialized twice, once based on defaults and command line arguments, then then again after user config file, Fixes #1992 --- pkg/setting/setting.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 389b6b933b9..77445dd6c4c 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -289,10 +289,13 @@ func loadConfiguration(args *CommandLineArgs) { // command line props commandLineProps := getCommandLineProperties(args.Args) - // load default overrides applyCommandLineDefaultProperties(commandLineProps) + // init logging before specific config so we can log errors from here on + DataPath = makeAbsolute(Cfg.Section("paths").Key("data").String(), HomePath) + initLogging(args) + // load specified config file loadSpecifedConfigFile(args.Config) @@ -304,6 +307,10 @@ func loadConfiguration(args *CommandLineArgs) { // evaluate config values containing environment variables evalConfigValues() + + // update data path and logging config + DataPath = makeAbsolute(Cfg.Section("paths").Key("data").String(), HomePath) + initLogging(args) } func pathExists(path string) bool { @@ -339,9 +346,6 @@ func NewConfigContext(args *CommandLineArgs) { setHomePath(args) loadConfiguration(args) - DataPath = makeAbsolute(Cfg.Section("paths").Key("data").String(), HomePath) - initLogging(args) - AppName = Cfg.Section("").Key("app_name").MustString("Grafana") Env = Cfg.Section("").Key("app_mode").MustString("development")