From ab13a29cb530457328cf9d3a2511c2db1d5ccaca Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 28 May 2014 01:53:06 -0400 Subject: Fix #209 --- modules/setting/setting.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'modules/setting') diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 7ae31a22dc..8cca57efed 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -62,8 +62,9 @@ var ( DisableGravatar bool // Log settings. - LogModes []string - LogConfigs []string + LogRootPath string + LogModes []string + LogConfigs []string // Cache settings. Cache cache.Cache @@ -145,7 +146,8 @@ func NewConfigContext() { SshPort = Cfg.MustInt("server", "SSH_PORT", 22) OfflineMode = Cfg.MustBool("server", "OFFLINE_MODE") DisableRouterLog = Cfg.MustBool("server", "DISABLE_ROUTER_LOG") - StaticRootPath = Cfg.MustValue("server", "STATIC_ROOT_PATH") + StaticRootPath = Cfg.MustValue("server", "STATIC_ROOT_PATH", workDir) + LogRootPath = Cfg.MustValue("log", "ROOT_PATH", path.Join(workDir, "log")) InstallLock = Cfg.MustBool("security", "INSTALL_LOCK") SecretKey = Cfg.MustValue("security", "SECRET_KEY") @@ -233,7 +235,7 @@ func newLogService() { case "console": LogConfigs[i] = fmt.Sprintf(`{"level":%s}`, level) case "file": - logPath := Cfg.MustValue(modeSec, "FILE_NAME", "log/gogs.log") + logPath := Cfg.MustValue(modeSec, "FILE_NAME", path.Join(LogRootPath, "gogs.log")) os.MkdirAll(path.Dir(logPath), os.ModePerm) LogConfigs[i] = fmt.Sprintf( `{"level":%s,"filename":"%s","rotate":%v,"maxlines":%d,"maxsize":%d,"daily":%v,"maxdays":%d}`, level, -- cgit v1.2.3