test.py (work):
import time
_, a, b = [1, 2, 3]
print a
print b
run the code: python test.py > test.log
you will get the log in test.log
test.py (not work):
import time
_, a, b = [1, 2, 3]
print a
print b
while True:
time.sleep(5)
But this one you get None in the log.
How do I get log before the program finished, without the python log module(just use the redirect '>')?