source: trunk/docs/services/debug.txt @ 398

Last change on this file since 398 was 398, checked in by lucadelu, 11 years ago

add debug page to documentation

File size: 2.1 KB
Line 
1.. _services-debug:
2
3How To Debug ZOO Services
4=========================
5
6There are different ways to debug your services, the most used solutions are via web
7or via command line.
8
9Web
10----
11
12Using the web request you can see any problem with the log file of Apache.
13
14On Unix system usually to log file is in ``/var/log/apache2`` and the useful file
15is ``error_log``. A simple way to look inside the file is to use ``tail`` command,
16it permits to see the update of the file for each request ::
17
18  tail -f /var/log/apache2/error_log
19
20If the log is not so clear you can add some information inside your code. You have to write
21in the standard error.
22
23Python
24********
25Using Python for example you can do this
26
27.. code-block:: python
28
29  import sys
30 
31  #add this line when you want see your message
32  sys.stderr.write("My message")
33
34
35Command line
36--------------
37
38It is possible to use the ZOO kernel ``zoo_loader.cgi`` also from command line.
39This is really useful to debug in a deeper way your service.
40
41.. code-block:: bash
42
43  # to use it you have to copy test_service.py and HelloPy.zcfg from
44  # the example services
45  ./zoo_loader.cgi "service=wps&version=1.0.0&request=execute&identifier=HelloPy&datainputs=a=your name&responsedocument=Result"
46
47Using this way you can use standard debug system of the programming language used
48in your service.
49
50GDB
51*****
52From command line you can use also the command line tool `GDB <http://www.gnu.org/software/gdb/>`_
53to debug ``zoo_loader.cgi``, you have to run
54
55.. code-block:: bash
56
57  # launch zoo_loader.cgi from gdb
58  gdb zoo_loader.cgi
59  # now run your request
60  run "service=wps&version=1.0.0&request=execute&identifier=HelloPy&datainputs=a=your name&responsedocument=Result"
61
62At this point you can ask help to the `ZOO mailing list <http://lists.osgeo.org/cgi-bin/mailman/listinfo/zoo-discuss>`_
63copying the result of the command.
64
65Python
66**********
67For Python you can use ``pdb``, more info at http://docs.python.org/2/library/pdb.html
68
69.. code-block:: python
70
71  import pdb
72 
73  # add this line when you want investigate more in the code
74  pdb.set_trace()
Note: See TracBrowser for help on using the repository browser.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png