Script error logs?

meithan

Member
Messages
32
Reaction score
0
Points
6
Hi.

Is there a way to see the server logs to debug my scripts? It's very annoying that I only get an "Internal Server Error" and no other indication whatsoever of what's going on.

I'm programming in Python, which has a facility for cgi script debugging (cgitb), but it only kicks in when the scripts run up to a certain point. If I could see the server log produced when the scripts runs, it would make debugging much easier.

Thanks.
 

dlukin

New Member
Messages
427
Reaction score
25
Points
0
cPanel --> Logs --> Error log

Not always very informative.

Either

import cgitb; cgitb.enable()

OR (for debugging only, not production)

import sys
sys.stderr = sys.stdout
print "Content-Type: text/plain"
print ""

will at least put the line number of the error in the error log.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
It's best to develop on your own server, where you have more control. You can use remote debugging to debug programs interactively.
 

meithan

Member
Messages
32
Reaction score
0
Points
6
cPanel --> Logs --> Error log

Not always very informative.

Either

import cgitb; cgitb.enable()

OR (for debugging only, not production)

import sys
sys.stderr = sys.stdout
print "Content-Type: text/plain"
print ""

will at least put the line number of the error in the error log.

Thanks, that was informative! I'll try those methods. I spent one hour this morning searching for a bug. It was a missing ' mark in one line.

It's best to develop on your own server, where you have more control. You can use remote debugging to debug programs interactively.

I don't have my own server, that's why I'm on x10hosting ;)
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
X10 is your production server. You should set up a development server (not publicly accessible) by installing a web server and DBMS. XAMPP runs on most platforms and includes most things you'll need. Another all-in-one package for MS Windows platforms is WampServer.
 
Last edited:

meithan

Member
Messages
32
Reaction score
0
Points
6
X10 is your production server. You should set up a development server (not publicly accessible) by installing a web server and DBMS. XAMPP runs on most platforms and includes most things you'll need. Another all-in-one package for MS Windows platforms is WampServer.

I was thinking that's what you meant: running a webserver on my own machine to do testing. It's a fabulous idea. Learning to use Apache will certainly be useful. I run Linux, so I'll look into the XAMPP package you suggested. Thanks for the tip!
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
Apache might be part of the default install for your distro. You can also use the package manager for you distro to install the various programs. XAMPP for Linux makes things a little easier by installing and letting you start/stop/restart everything at once and by having a useful default configuration, but you still have to make configuration changes by hand.
 
Top