Debugging ZOO Services¶
Several methods can be used in order to debug ZOO-Services. The most common solutions are web or command line.
Web¶
Any problem can be checked in the Apache server log file when using http WPS requests.
On Unix, the log files is usually located in /var/log/apache2
and
the relevant one is named error_log. A simple way to read this file is to use the tail
command,
as it allows to see the file updates for each request
tail -f /var/log/apache2/error_log
If the log is not clear enough, you still have the possibility to add more debug information to your source code, writing to standard errors.
Python¶
Using Python, you can for example do this:
import sys
#add this line when you want see an own message
sys.stderr.write("My message")
Javascript¶
Using JavaScript, you can use alert
to print a string to standard error, for example:
// add this line when you want to see own message
alert('My message')
// you can debug value of inputs, outputs or conf
alert(inputs["S"]["value"])
Note
If you try to pass an object it will only return [object Object]
Command line¶
ZOO-Kernel (zoo_loader.cgi) can also be used from command line. This is really useful for debugging services in a deeper way, for example:.
# in order to use it you have to copy test_service.py and HelloPy.zcfg from
# the example services
./zoo_loader.cgi "service=wps&version=1.0.0&request=execute&identifier=HelloPy&datainputs=a=your name&responsedocument=Result"
Working this way you can use the standard debug system of the actual programming language used to develop your service.
In case you should simulate P