We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
seek := &tail.SeekInfo{} seek.Offset = 0 seek.Whence = os.SEEK_END config := tail.Config{} config.Follow = true //config.ReOpen = true config.Location = seek tails, err := tail.TailFile(filename, config)
When I stop using ReOpen,I got as below:
Stopping tail as file no longer exists: my.log
The text was updated successfully, but these errors were encountered:
What's wrong with my code???
func main() { filename := "my.log"
seek := &tail.SeekInfo{} seek.Offset = 0 seek.Whence = os.SEEK_END config := tail.Config{} config.Follow = true //config.ReOpen = true config.Location = seek tails, err := tail.TailFile(filename, config) if err != nil { fmt.Println("tail file err:", err) return } var msg *tail.Line var ok bool for true { msg, ok = <-tails.Lines if !ok { fmt.Printf("tail file close reopen, filename:%s\n", tails.Filename) time.Sleep(100 * time.Millisecond) continue } fmt.Println("msg:", msg) }
}
Sorry, something went wrong.
No branches or pull requests
When I stop using ReOpen,I got as below:
Stopping tail as file no longer exists: my.log
The text was updated successfully, but these errors were encountered: