I use Python3.6 to write a simple HTTP server to redirect all requests.
The file I written can be found here
I can see output in both Win8.1 CMD & Ubuntu 16.04.3 Bash. However , whatever I try any of those methods below , it doesn't work , the log cannot be saved into the file.
nohup python3 ./filename.py > ./logfile 2>&1 &
python3 ./filename.py > ./logfile 2>&1 &
setsid ./filename.py > ./logfile 2>&1 &
I tried to use:
import sys
logfile = open('logfile.log','w')
sys.stdout = logfile
sys.stdin = logfile
sys.stderr = logfile
It didn't work.