On my local development machine, I catch and post errors to stderr, which is then redirected to my local error log. When I update my Site 5 site, there shouldn’t be any errors … but, of course there are.
Unfortunately, my error log tells me that an error occured, but not what the error was:
[Sat Jun 16 11:18:38 2012] [warn] [client 71.34.53.115] mod_fcgid: stderr: File “/home/jimdscot/public_html/hoops_web.py”, line 141, in GET, referer: http://www.jimdscott.com/choops
File “/home/jimdscot/public_html/hoops_web.py”, line 151, in _do_work
File “/home/jimdscot/public_html/hoops_web.py”, line 131, in GET
In these modules, the error is being caught and written out to stderr. Is there a way to get the output to stderr included in my error log?
Answer #1
When dealing with a script issue the best way to get the error output is to simply execute the file that is having issues on the server itself. In this case, the hoops_web.py is erroring out so if you login via SSH to your account and execute the script it will return the actual error.
I can see by your account that the script is already chmod’d to 755, so running it by typing the following into my bash terminal returns the following error:
[~/public_html]# ./hoops_web.py
./hoops_web.py: line 19: syntax error near unexpected token `(‘
./hoops_web.py: line 19: `urls = (‘
In this way you can see that there’s a syntax error on line 19 of the script which will need to be resolved before it’ll work as intended.
Now, in regards to redirecting the stderr output to a file, you can do this by simply executing the script like so:
[~/public_html]# ./hoops_web.py 2> error.log
By appending the 2> error.log you’re telling bash that you want to redirect the stderr output to the file error.log, which you can then open in your text editor of choice.
I hope that helps.