I have a simple python program, sample.py:
import time
n = 1
while True:
print 'Testing', n
n += 1
time.sleep (1)
When I run the program in bash as a background job:
$ python sample.py &> sample.log &
Now watch the log file:
$ watch tail -n5 sample.log
I don't see anything unless the program is stopped. Also, if view the sample.log file in any text editor, its empty.
So, how can I view the changes in the log file in real-time?