From 7151b96465b1456a12407e34b67e5aff2be24a71 Mon Sep 17 00:00:00 2001 From: "Ryan A. Chapman" Date: Sun, 29 Nov 2015 15:09:28 -0700 Subject: [PATCH] Log config parsing errors Beego currently handles the case of "conf/app.conf" not existing, but all other errors are not logged. This fixes that. I ran into an issue where beego was not listening on the correct port, and it turned out that the conf/app.conf file had a colon ":" instead of an equal sign "=" (confusion of INI vs YAML formats). When there was a parsing error, beego would give up on parsing app.conf and not log anything to the console. --- config.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config.go b/config.go index d9ff624c..85da1c30 100644 --- a/config.go +++ b/config.go @@ -354,10 +354,12 @@ func init() { SetLogFuncCall(true) err = ParseConfig() - if err != nil && os.IsNotExist(err) { - // for init if doesn't have app.conf will not panic - ac := config.NewFakeConfig() - AppConfig = &beegoAppConfig{ac} + if err != nil { + if os.IsNotExist(err) { + // for init if doesn't have app.conf will not panic + ac := config.NewFakeConfig() + AppConfig = &beegoAppConfig{ac} + } Warning(err) } } -- GitLab