Open xkeyideal opened 7 years ago
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.
In windows the default inotify doesn't work too well... try using polling instead:
cfg := tail.Config{ReOpen: true, MustExist: false, Follow: true, Poll: true}
Does that help at all?
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.