source: branches/PublicaMundi_David-devel/docs/_build/html/services/debug.html @ 659

Last change on this file since 659 was 659, checked in by nbozon, 9 years ago

Massive update of zoo docs

File size: 14.7 KB
Line 
1
2
3<!DOCTYPE html>
4<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
5<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
6<head>
7  <meta charset="utf-8">
8  <meta name="viewport" content="width=device-width, initial-scale=1.0">
9 
10  <title>Debugging ZOO Services &mdash; ZOO-Project 1.4a0 documentation</title>
11 
12  <link href="http://fonts.googleapis.com/css?family=Days+One" rel="stylesheet" type="text/css">
13 
14 
15
16 
17
18 
19 
20   
21      <link rel="search" type="application/opensearchdescription+xml" title="Search within ZOO-Project 1.4a0 documentation" href="../_static/opensearch.xml"/>
22   
23
24 
25
26 
27 
28    <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
29 
30
31 
32
33 
34    <link rel="top" title="ZOO-Project 1.4a0 documentation" href="../index.html"/>
35        <link rel="up" title="ZOO-Services" href="index.html"/>
36        <link rel="next" title="Available ZOO-Services" href="zoo-services.html"/>
37        <link rel="prev" title="ZOO Status Service" href="status.html"/> 
38
39 
40  <script src="_static/js/modernizr.min.js"></script>
41
42</head>
43
44<body class="wy-body-for-nav" role="document">
45
46  <div class="wy-grid-for-nav">
47
48   
49    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
50      <div class="wy-side-nav-search">
51       
52
53       
54          <a class="shrink" href="http://zoo-project.org"><img src="http://zoo-project.org/img/zoo-sun-logo.png" class="img-responsive sun" style="display: inline;"> ZOO</a>
55       
56
57       
58        </a>
59
60       
61<div role="search">
62  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
63    <input type="text" name="q" placeholder="Search docs" />
64    <input type="hidden" name="check_keywords" value="yes" />
65    <input type="hidden" name="area" value="default" />
66  </form>
67</div>
68
69       
70      </div>
71
72      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
73       
74         
75         
76              <ul class="current">
77<li class="toctree-l1"><a class="reference internal" href="../intro.html">Introduction</a><ul>
78<li class="toctree-l2"><a class="reference internal" href="../intro.html#what-is-zoo-project">What is ZOO-Project ?</a></li>
79<li class="toctree-l2"><a class="reference internal" href="../intro.html#zoo-project-components">ZOO-Project components</a></li>
80<li class="toctree-l2"><a class="reference internal" href="../intro.html#open-source">Open Source</a></li>
81</ul>
82</li>
83<li class="toctree-l1"><a class="reference internal" href="../install/index.html">ZOO-Project installation</a><ul>
84<li class="toctree-l2"><a class="reference internal" href="../install/install-prerequisites.html">Prerequisites</a></li>
85<li class="toctree-l2"><a class="reference internal" href="../install/install-download.html">Download</a></li>
86<li class="toctree-l2"><a class="reference internal" href="../install/install-confoptions.html">Configure options</a></li>
87<li class="toctree-l2"><a class="reference internal" href="../install/install-installation.html">Installation on Unix/Linux</a></li>
88<li class="toctree-l2"><a class="reference internal" href="../install/install-onwindows.html">Installation on Windows ™</a></li>
89<li class="toctree-l2"><a class="reference internal" href="../install/install-onmacos.html">Installation on MacOSX ™</a></li>
90</ul>
91</li>
92<li class="toctree-l1"><a class="reference internal" href="../kernel/index.html">ZOO-Kernel</a><ul>
93<li class="toctree-l2"><a class="reference internal" href="../kernel/what.html">What is ZOO-Kernel ?</a></li>
94<li class="toctree-l2"><a class="reference internal" href="../kernel/configuration.html">ZOO-Kernel configuration</a></li>
95<li class="toctree-l2"><a class="reference internal" href="../kernel/mapserver.html">Optional MapServer support</a></li>
96<li class="toctree-l2"><a class="reference internal" href="../kernel/orfeotoolbox.html">Optional Orfeo Toolbox support</a></li>
97<li class="toctree-l2"><a class="reference internal" href="../kernel/sagagis.html">Optional SAGA GIS support</a></li>
98</ul>
99</li>
100<li class="toctree-l1 current"><a class="reference internal" href="index.html">ZOO-Services</a><ul class="current">
101<li class="toctree-l2"><a class="reference internal" href="what.html">What are ZOO-Services ?</a></li>
102<li class="toctree-l2"><a class="reference internal" href="zcfg-reference.html">ZOO-Service configuration file</a></li>
103<li class="toctree-l2"><a class="reference internal" href="process-profiles.html">Process profiles registry</a></li>
104<li class="toctree-l2"><a class="reference internal" href="howtos.html">Create your own ZOO-Services</a></li>
105<li class="toctree-l2"><a class="reference internal" href="status.html">ZOO Status Service</a></li>
106<li class="toctree-l2 current"><a class="current reference internal" href="">Debugging ZOO Services</a></li>
107<li class="toctree-l2"><a class="reference internal" href="zoo-services.html">Available ZOO-Services</a></li>
108</ul>
109</li>
110<li class="toctree-l1"><a class="reference internal" href="../api/index.html">ZOO-API</a><ul>
111<li class="toctree-l2"><a class="reference internal" href="../api/what.html">What is ZOO-API ?</a></li>
112<li class="toctree-l2"><a class="reference internal" href="../api/howto.html">Using ZOO-API</a></li>
113<li class="toctree-l2"><a class="reference internal" href="../api/classes.html">ZOO-API Classes</a></li>
114<li class="toctree-l2"><a class="reference internal" href="../api/examples.html">Examples</a></li>
115</ul>
116</li>
117<li class="toctree-l1"><a class="reference internal" href="../client/index.html">ZOO-Client</a><ul>
118<li class="toctree-l2"><a class="reference internal" href="../client/what.html">What is ZOO-Client ?</a></li>
119<li class="toctree-l2"><a class="reference internal" href="../client/howto.html">Using ZOO-Client</a></li>
120<li class="toctree-l2"><a class="reference internal" href="../client/example.html">Example application</a></li>
121</ul>
122</li>
123<li class="toctree-l1"><a class="reference internal" href="../contribute/index.html">Contributor Guide</a><ul>
124<li class="toctree-l2"><a class="reference internal" href="../contribute/howto.html">How to contribute ?</a></li>
125<li class="toctree-l2"><a class="reference internal" href="../contribute/code.html">Contribute code</a></li>
126</ul>
127</li>
128</ul>
129
130         
131       
132      </div>
133      &nbsp;
134    </nav>
135
136    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
137
138     
139      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
140        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
141        <a href="../contents.html">ZOO-Project</a>
142      </nav>
143
144
145     
146      <div class="wy-nav-content">
147        <div class="rst-content">
148          <div role="navigation" aria-label="breadcrumbs navigation">
149  <ul class="wy-breadcrumbs">
150
151    <li><a href="../contents.html"> Docs</a> &#8725; &#160;</li>
152     
153          <li><a href="index.html">ZOO-Services</a> &#8725; &#160;</li>
154     
155    <li>Debugging ZOO Services</li>
156      <li class="wy-breadcrumbs-aside">
157       
158          <a href="../_sources/services/debug.txt" rel="nofollow"> View page source</a>
159       
160      </li>
161  </ul>
162  <hr/>
163</div>
164          <div role="main" class="document">
165           
166  <div class="section" id="debugging-zoo-services">
167<span id="services-debug"></span><h1>Debugging ZOO Services<a class="headerlink" href="#debugging-zoo-services" title="Permalink to this headline"></a></h1>
168<p>Several methods can be used in order to debug <a class="reference internal" href="index.html#services-index"><span>ZOO-Services</span></a>. The most common solutions are web or command line.</p>
169<div class="section" id="web">
170<h2>Web<a class="headerlink" href="#web" title="Permalink to this headline"></a></h2>
171<p>Any problem can be checked in the Apache server log file when using http WPS requests.</p>
172<p>On Unix, the log files is usually located in <code class="docutils literal"><span class="pre">/var/log/apache2</span></code> and
173the relevant one is named <em>error_log</em>. A simple way to read this file is to use the <code class="docutils literal"><span class="pre">tail</span></code> command,
174as it allows to see the file updates for each request</p>
175<div class="highlight-python"><div class="highlight"><pre><span class="n">tail</span> <span class="o">-</span><span class="n">f</span> <span class="o">/</span><span class="n">var</span><span class="o">/</span><span class="n">log</span><span class="o">/</span><span class="n">apache2</span><span class="o">/</span><span class="n">error_log</span>
176</pre></div>
177</div>
178<p>If the log is not clear enough, you still have the possibility to add
179more debug information to your source code, writing to standard errors.</p>
180<div class="section" id="python">
181<h3>Python<a class="headerlink" href="#python" title="Permalink to this headline"></a></h3>
182<p>Using Python, you can for example do this:</p>
183<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span>
184
185<span class="c">#add this line when you want see an own message</span>
186<span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&quot;My message&quot;</span><span class="p">)</span>
187</pre></div>
188</div>
189</div>
190<div class="section" id="javascript">
191<span id="web-javascript"></span><h3>Javascript<a class="headerlink" href="#javascript" title="Permalink to this headline"></a></h3>
192<p>Using JavaScript, you can use <code class="docutils literal"><span class="pre">alert</span></code> to print a string to standard error, for example:</p>
193<div class="highlight-javascript"><div class="highlight"><pre><span class="c1">// add this line when you want to see own message</span>
194<span class="nx">alert</span><span class="p">(</span><span class="s1">&#39;My message&#39;</span><span class="p">)</span>
195<span class="c1">// you can debug value of inputs, outputs or conf</span>
196<span class="nx">alert</span><span class="p">(</span><span class="nx">inputs</span><span class="p">[</span><span class="s2">&quot;S&quot;</span><span class="p">][</span><span class="s2">&quot;value&quot;</span><span class="p">])</span>
197</pre></div>
198</div>
199<div class="admonition note">
200<p class="first admonition-title">Note</p>
201<p class="last">If you try to pass an object it will only return <code class="docutils literal"><span class="pre">[object</span> <span class="pre">Object]</span></code></p>
202</div>
203</div>
204</div>
205<div class="section" id="command-line">
206<h2>Command line<a class="headerlink" href="#command-line" title="Permalink to this headline"></a></h2>
207<p><a class="reference internal" href="../kernel/index.html#kernel-index"><span>ZOO-Kernel</span></a> (<em>zoo_loader.cgi</em>) can also be used from command line. This is really useful for debugging services in a deeper way, for example:.</p>
208<div class="highlight-bash"><div class="highlight"><pre><span class="c"># in order to use it you have to copy test_service.py and HelloPy.zcfg from</span>
209<span class="c"># the example services</span>
210./zoo_loader.cgi <span class="s2">&quot;service=wps&amp;version=1.0.0&amp;request=execute&amp;identifier=HelloPy&amp;datainputs=a=your name&amp;responsedocument=Result&quot;</span>
211</pre></div>
212</div>
213<p>Working this way you can use the standard debug system of the actual programming language used
214to develop your service.</p>
215<div class="section" id="gdb">
216<h3>GDB<a class="headerlink" href="#gdb" title="Permalink to this headline"></a></h3>
217<p>From command line you can use also the command line tool <a class="reference external" href="http://www.gnu.org/software/gdb/">GDB</a>
218to debug <code class="docutils literal"><span class="pre">zoo_loader.cgi</span></code>, you have to run:</p>
219<div class="highlight-bash"><div class="highlight"><pre><span class="c"># launch zoo_loader.cgi from gdb</span>
220gdb zoo_loader.cgi
221<span class="c"># now run your request</span>
222run <span class="s2">&quot;service=wps&amp;version=1.0.0&amp;request=execute&amp;identifier=HelloPy&amp;datainputs=a=your name&amp;responsedocument=Result&quot;</span>
223</pre></div>
224</div>
225<p>At this point you can ask help at the <a class="reference external" href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/zoo-discuss">ZOO mailing list</a>
226copying the result of the command.</p>
227</div>
228<div class="section" id="id2">
229<h3>Python<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
230<p>For Python, you can use <code class="docutils literal"><span class="pre">pdb</span></code>, more info at <a class="reference external" href="http://docs.python.org/2/library/pdb.html">http://docs.python.org/2/library/pdb.html</a></p>
231<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">pdb</span>
232
233<span class="c"># add this line when you want investigate your code in more detail</span>
234<span class="n">pdb</span><span class="o">.</span><span class="n">set_trace</span><span class="p">()</span>
235</pre></div>
236</div>
237</div>
238<div class="section" id="id3">
239<h3>Javascript<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
240<p>You can use <code class="docutils literal"><span class="pre">alert</span></code> also to print in the console, more info in the <a class="reference internal" href="#web-javascript"><span>Javascript</span></a> web section</p>
241</div>
242</div>
243</div>
244
245
246          </div>
247          <footer>
248 
249    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
250     
251        <a href="zoo-services.html" class="btn btn-neutral float-right" title="Available ZOO-Services">Next <span class="fa fa-arrow-circle-right"></span></a>
252     
253     
254        <a href="status.html" class="btn btn-neutral" title="ZOO Status Service"><span class="fa fa-arrow-circle-left"></span> Previous</a>
255     
256    </div>
257 
258
259  <hr/>
260  <div class="pfoot">
261  <div role="contentinfo">
262    <p>
263        &copy; Copyright 2009-2015, ZOO-Project team.
264    </p>
265  </div>
266  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> inspired by <a href="https://readthedocs.org">Read the Docs</a>.
267</div>
268</footer>
269
270        </div>
271      </div>
272
273    </section>
274
275  </div>
276 
277
278
279 
280
281    <script type="text/javascript">
282        var DOCUMENTATION_OPTIONS = {
283            URL_ROOT:'../',
284            VERSION:'1.4a0',
285            COLLAPSE_INDEX:false,
286            FILE_SUFFIX:'.html',
287            HAS_SOURCE:  true
288        };
289    </script>
290      <script type="text/javascript" src="../_static/jquery.js"></script>
291      <script type="text/javascript" src="../_static/underscore.js"></script>
292      <script type="text/javascript" src="../_static/doctools.js"></script>
293
294 
295
296 
297 
298    <script type="text/javascript" src="../_static/js/theme.js"></script>
299 
300
301 
302 
303  <script type="text/javascript">
304      jQuery(function () {
305          SphinxRtdTheme.StickyNav.enable();
306      });
307  </script>
308   
309
310</body>
311</html>
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