1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 22:10:48 +00:00

add os.Chmod when create log file

This commit is contained in:
GuyCheung 2016-06-21 15:52:31 +08:00
parent 1fe2226c11
commit cb3f240f44

View File

@ -159,6 +159,10 @@ func (w *fileLogWriter) createLogFile() (*os.File, error) {
return nil, err
}
fd, err := os.OpenFile(w.Filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, os.FileMode(perm))
if err == nil {
// Make sure file perm is user set perm cause of `os.OpenFile` will obey umask
os.Chmod(w.Filename, w.Perm)
}
return fd, err
}