diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2014-03-31 21:26:15 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2014-03-31 21:26:15 +0800 |
commit | a187ba96512a49ac7888d87960657ab6ee369a50 (patch) | |
tree | bf38225add4f9c9437cb67709ac138ac40994479 /models | |
parent | 76c64b43cb56a298e5fc2ec8adc0d7b820cbe614 (diff) | |
download | gitea-a187ba96512a49ac7888d87960657ab6ee369a50.tar.gz gitea-a187ba96512a49ac7888d87960657ab6ee369a50.zip |
improved log locations
Diffstat (limited to 'models')
-rw-r--r-- | models/models.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/models/models.go b/models/models.go index a626b98f6e..384f1fc425 100644 --- a/models/models.go +++ b/models/models.go @@ -83,15 +83,19 @@ func SetEngine() (err error) { // WARNNING: for serv command, MUST remove the output to os.stdout, // so use log file to instead print to stdout. + execDir, _ := base.ExecDir() + logPath := execDir + "/log/xorm.log" + os.MkdirAll(path.Dir(logPath), os.ModePerm) - //x.ShowDebug = true - //orm.ShowErr = true - f, err := os.Create("xorm.log") + f, err := os.Create(logPath) if err != nil { return fmt.Errorf("models.init(fail to create xorm.log): %v\n", err) } orm.Logger = f + orm.ShowSQL = true + orm.ShowDebug = true + orm.ShowErr = true return nil } |