Windows OS, go 1.7.4
cfg := tail.Config{ReOpen: true, MustExist: false, Follow: true}
t, err := tail.TailFile("D:\log\hotelprice\server\hotelprice_log4.log", cfg)
if err != nil {
fmt.Println(err)
}
for line := range t.Lines {
fmt.Println(line.Text)
}
the hotelprice_log4.log file is not exist.
- create the file hotelprice_log4.log
- open the file, then write contents, close it
but the program can't print the contents