summaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-05-28 01:53:06 -0400
committerUnknown <joe2010xtmf@163.com>2014-05-28 01:53:06 -0400
commitab13a29cb530457328cf9d3a2511c2db1d5ccaca (patch)
treefae4cca0e4b24f81f7896b8f8dfab909c2e98bc8 /modules/setting
parentff690fd9760e0cfb5ae9e49aecb7a201f7ca8304 (diff)
downloadgitea-ab13a29cb530457328cf9d3a2511c2db1d5ccaca.tar.gz
gitea-ab13a29cb530457328cf9d3a2511c2db1d5ccaca.zip
Fix #209
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/setting.go10
1 files changed, 6 insertions, 4 deletions
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,