Fix bug related to log

This commit is contained in:
Unknown 2014-04-06 13:41:58 -04:00
parent 794cd27db3
commit 6a16866f4e
4 changed files with 6 additions and 4 deletions

View file

@ -14,7 +14,7 @@ LICENSES = Apache v2 License|GPL v2|MIT License|Affero GPL|Artistic License 2.0|
[server] [server]
PROTOCOL = http PROTOCOL = http
DOMAIN = localhost DOMAIN = localhost
ROOT_URL = %(PROTOCOL)://%(DOMAIN)s:%(HTTP_PORT)s/ ROOT_URL = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
HTTP_ADDR = HTTP_ADDR =
HTTP_PORT = 3000 HTTP_PORT = 3000
CERT_FILE = cert.pem CERT_FILE = cert.pem

View file

@ -288,7 +288,7 @@ func NewConfigContext() {
if err != nil { if err != nil {
qlog.Fatalf("Fail to get home directory): %v\n", err) qlog.Fatalf("Fail to get home directory): %v\n", err)
} }
RepoRootPath = Cfg.MustValue("repository", "ROOT", filepath.Join(homeDir, "git/gogs-repositories")) RepoRootPath = Cfg.MustValue("repository", "ROOT", filepath.Join(homeDir, "gogs-repositories"))
if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil { if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil {
qlog.Fatalf("Fail to create RepoRootPath(%s): %v\n", RepoRootPath, err) qlog.Fatalf("Fail to create RepoRootPath(%s): %v\n", RepoRootPath, err)
} }

View file

@ -46,7 +46,8 @@ gogs serv provide access auth for repositories`,
func newLogger(execDir string) { func newLogger(execDir string) {
logPath := execDir + "/log/serv.log" logPath := execDir + "/log/serv.log"
os.MkdirAll(path.Dir(logPath), os.ModePerm) os.MkdirAll(path.Dir(logPath), os.ModePerm)
f, err := os.Open(logPath)
f, err := os.OpenFile(logPath, os.O_WRONLY|os.O_APPEND|os.O_CREATE, os.ModePerm)
if err != nil { if err != nil {
qlog.Fatal(err) qlog.Fatal(err)
} }

View file

@ -32,7 +32,8 @@ gogs serv provide access auth for repositories`,
func newUpdateLogger(execDir string) { func newUpdateLogger(execDir string) {
logPath := execDir + "/log/update.log" logPath := execDir + "/log/update.log"
os.MkdirAll(path.Dir(logPath), os.ModePerm) os.MkdirAll(path.Dir(logPath), os.ModePerm)
f, err := os.Open(logPath)
f, err := os.OpenFile(logPath, os.O_WRONLY|os.O_APPEND|os.O_CREATE, os.ModePerm)
if err != nil { if err != nil {
qlog.Fatal(err) qlog.Fatal(err)
} }