You should redirecte sys.stderr if you want to log error message.

   saveout = sys.stdout
   saveerr = sys.stderr
   fsock = open('runtime.log', 'w')
   sys.stdout = sys.stderr = fsock

2005/12/28, Randy Kreuziger <[EMAIL PROTECTED]>:
Can stdout and stderr be redirected to the same file?  I would like to redirect both to the same file but I'm not sure how to do it.  Currenting I'm redirectiong stdout using the following code:
   saveout = sys.stdout
   fsock = open('runtime.log', 'w')
   sys.stdout = fsock
 
The problem is that when en error occurs that my program was not written to handle that error message is being sent to the cmd window and not my log file.  My program may simply need to be more robust however I'm still a python novice.
 
Thanks
 

--
http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to