diff --git a/logs/file.go b/logs/file.go index 1c2db882..33fee1cf 100644 --- a/logs/file.go +++ b/logs/file.go @@ -271,7 +271,7 @@ func (w *fileLogWriter) doRotate(logTime time.Time) error { if err != nil { goto RESTART_LOGGER } - err = os.Chmod(fName, os.FileMode(0440)) + err = os.Chmod(fName, os.FileMode(0444)) // re-start logger RESTART_LOGGER: diff --git a/logs/file_test.go b/logs/file_test.go index f345ff20..ba0850b1 100644 --- a/logs/file_test.go +++ b/logs/file_test.go @@ -175,7 +175,7 @@ func TestFileRotate_06(t *testing.T) { //test file mode log.Emergency("emergency") rotateName := "test3" + fmt.Sprintf(".%s.%03d", time.Now().Format("2006-01-02"), 1) + ".log" s, _ := os.Lstat(rotateName) - if s.Mode() != 0440 { + if s.Mode() != 0444 { os.Remove(rotateName) os.Remove("test3.log") t.Fatal("rotate file mode error")