1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 14:20:54 +00:00

Provide permission to access old log files to everyone

This commit is contained in:
Jia Li Ong 2017-06-01 17:48:48 +08:00
parent cab8458c1c
commit 0ea34fff27
2 changed files with 2 additions and 2 deletions

View File

@ -271,7 +271,7 @@ func (w *fileLogWriter) doRotate(logTime time.Time) error {
if err != nil { if err != nil {
goto RESTART_LOGGER goto RESTART_LOGGER
} }
err = os.Chmod(fName, os.FileMode(0440)) err = os.Chmod(fName, os.FileMode(0444))
// re-start logger // re-start logger
RESTART_LOGGER: RESTART_LOGGER:

View File

@ -175,7 +175,7 @@ func TestFileRotate_06(t *testing.T) { //test file mode
log.Emergency("emergency") log.Emergency("emergency")
rotateName := "test3" + fmt.Sprintf(".%s.%03d", time.Now().Format("2006-01-02"), 1) + ".log" rotateName := "test3" + fmt.Sprintf(".%s.%03d", time.Now().Format("2006-01-02"), 1) + ".log"
s, _ := os.Lstat(rotateName) s, _ := os.Lstat(rotateName)
if s.Mode() != 0440 { if s.Mode() != 0444 {
os.Remove(rotateName) os.Remove(rotateName)
os.Remove("test3.log") os.Remove("test3.log")
t.Fatal("rotate file mode error") t.Fatal("rotate file mode error")