Skip to content
New issue

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

reopen fails to reopen #5

Open
chrisleavoy opened this issue Sep 15, 2017 · 2 comments
Open

reopen fails to reopen #5

chrisleavoy opened this issue Sep 15, 2017 · 2 comments

Comments

@chrisleavoy
Copy link

chrisleavoy commented Sep 15, 2017

repro:

touch test.log
./go-tail -F ./test.log &
date > test.log
Fri Sep 15 13:26:55 EDT 2017
mv test.log test.log0 ; touch test.log
open ./test.log: no such file or directory
date >> test.log
# tail is hung/crashed, doesn't exit

Expected: no error, and date to be outputted twice.

@xocasdashdash
Copy link

This error is related to this lines of code: https://github.com/papertrail/go-tail/blob/master/follower/follower.go#L202-L210

Basically it detects the error but it doesn't do anything about it

@keithknott26
Copy link

keithknott26 commented Nov 29, 2019

I was able to fix this by adding a hack (sleep) after line 204:

default: if !t.config.Reopen { return nil } time.Sleep(30 * time.Second) if err := t.rewatch(); err != nil { return err }

This way if the file is moved (and then moved back) in 10s it gets reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants