Link to home
Start Free TrialLog in
Avatar of CynthiaZCar
CynthiaZCarFlag for United States of America

asked on

Does Tail.exe lock the files it reads?

We are having an issue with log files not updating.  One of the guys is using Tail.exe from Microsoft to read a specified number of lines from the bottom of the log file.    Since I don't have the code behind the tail.exe, it's difficult to know how file locking may be affecting updating the log files.  

How does tail.exe work with file locking?  If tail.exe is called multiple times for the same log file, would that keep the log file from updating because it's locked?  Thanks!
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CynthiaZCar

ASKER

I agree that calling tail.exe -f somefile.log would defeat the purpose of tail.  However, they are not using tail.exe -f somefile.log.  They are refreshing - looping through the call to the logfile with just tail and the number of lines to show at 1-2 second intervals - almost a constant refresh.  What we're seeing is that when the refresh is turned on - through the GUI - the logfile stops updating - as though it's locked.
Then I'd rather go for 'tail -f' instead of looping...
Thank you for your quick response to my question.
Avatar of randallxski
randallxski

The correct answer to this question is, "Yes".  Tail.exe does in fact place at least a partial lock on the file.  For proof, try tail -f mylog.log and then try to delete or rename the log file.  You will get an error that the file is being used by another person or process.