View Single Post
Old Jun 1st, 2006, 2:00 PM   #3
Cerulean
Professional Programmer
 
Cerulean's Avatar
 
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4 Cerulean is on a distinguished road
You generally do this from the command line. Not sure if this is the same with windows (doubtful) but under Linux (with BASH) you generally do
python foo.py > logfile.txt 2>&1
The `2>&1` bit redirects stderr into stdout, and the `> logfile.txt` bit redirects stdout into logfile.txt.
If you're writing to stderr from your Python program then you want to just set sys.stderr to sys.stdout at the top of your source file, which will effectively 'redirect' everything to STDOUT.
Cerulean is offline   Reply With Quote