A Python 2.7 script outputs some debug info via print
as it runs.
....
print datetime.now()
...
This script is started by forever.js :
forever start -c python myPrintingScript.py
However when I want to check the output of the Python script, nothing shows up in the logs.
Running forever logs 0
returns nothing. But the script definitely is running and has not crashed/restarted.
Question: Is there a way to get the Python script to print debug info such that it also appears in the log files of forever
?
You can specify output logs for forever
-l LOGFILE Logs the forever output to LOGFILE
-o OUTFILE Logs stdout from child script to OUTFILE
-e ERRFILE Logs stderr from child script to ERRFILE
For example:
forever -o out.log -e err.log myPrintingScript.py
Please do as this:
import sys
print "xxxx"
sys.stdout.flush()
Then you will see xxxx
in the log file that forever created.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.