<liclass="toctree-l4"><aclass="reference external"href="https://commons.apache.org/proper/commons-ognl/language-guide.html">OGNL official guide</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#check-the-out-parameters-and-return-value">Check the <codeclass="docutils literal notranslate"><spanclass="pre">out</span><spanclass="pre">parameters</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">return</span><spanclass="pre">value</span></code></a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#check-before-and-after-at-the-same-time">Check <em>before</em> and <em>after</em> at the same time</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#use-x-to-check-more-details">Use <codeclass="docutils literal notranslate"><spanclass="pre">-x</span></code> to check more details</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#use-condition-expressions-to-locate-specific-call">Use condition expressions to locate specific call</a></li>
<liclass="toctree-l1"><aclass="reference external"href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<liclass="toctree-l1"><aclass="reference external"href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<liclass="toctree-l1"><aclass="reference external"href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md#">Compile and debug/CONTRIBUTING</a></li>
<h1>watch<aclass="headerlink"href="#watch"title="Permalink to this headline">¶</a></h1>
<p>Monitor methods in data aspect including <codeclass="docutils literal notranslate"><spanclass="pre">return</span><spanclass="pre">values</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">exceptions</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">parameters</span></code>.</p>
<p>With the help of <aclass="reference external"href="https://commons.apache.org/proper/commons-ognl/index.html">OGNL</a>, you can easily check the details of variables when methods being invoked.</p>
<h2>Parameters & Options<aclass="headerlink"href="#parameters-options"title="Permalink to this headline">¶</a></h2>
<p>There are four different scenarios for <codeclass="docutils literal notranslate"><spanclass="pre">watch</span></code> command, which makes it rather complicated.</p>
<li><p>any valid OGNL expression as <codeclass="docutils literal notranslate"><spanclass="pre">"{params,returnObj}"</span></code> supported</p></li>
<li><p>there are four <em>watching</em> points: <codeclass="docutils literal notranslate"><spanclass="pre">-b</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">-e</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">-s</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">-f</span></code> (the first three are off in default while <codeclass="docutils literal notranslate"><spanclass="pre">-f</span></code> on);</p></li>
<li><p>at the <em>watching</em> point, Arthas will use the <em>expression</em> to evaluate the variables and print them out;</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">in</span><spanclass="pre">parameters</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">out</span><spanclass="pre">parameters</span></code> are different since they can be modified within the invoked methods; <codeclass="docutils literal notranslate"><spanclass="pre">params</span></code> stands for <codeclass="docutils literal notranslate"><spanclass="pre">in</span><spanclass="pre">parameters</span></code> in <codeclass="docutils literal notranslate"><spanclass="pre">-b</span></code>while <codeclass="docutils literal notranslate"><spanclass="pre">out</span><spanclass="pre">parameters</span></code> in other <em>watching</em> points;</p></li>
<li><p>there are no <codeclass="docutils literal notranslate"><spanclass="pre">return</span><spanclass="pre">values</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">exceptions</span></code> when using <codeclass="docutils literal notranslate"><spanclass="pre">-b</span></code>.</p></li>
<liclass="toctree-l1"><aclass="reference external"href="https://commons.apache.org/proper/commons-ognl/language-guide.html">OGNL official guide</a></li>
<h3>Check the <codeclass="docutils literal notranslate"><spanclass="pre">out</span><spanclass="pre">parameters</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">return</span><spanclass="pre">value</span></code><aclass="headerlink"href="#check-the-out-parameters-and-return-value"title="Permalink to this headline">¶</a></h3>
<h3>Check <codeclass="docutils literal notranslate"><spanclass="pre">in</span><spanclass="pre">parameters</span></code><aclass="headerlink"href="#check-in-parameters"title="Permalink to this headline">¶</a></h3>
<h3>Check <em>before</em> and <em>after</em> at the same time<aclass="headerlink"href="#check-before-and-after-at-the-same-time"title="Permalink to this headline">¶</a></h3>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">-n</span><spanclass="pre">2</span></code>: threshold of execution times is 2.</p></li>
<li><p>the first block of output is the <em>before watching</em> point;</p></li>
<li><p>*the order of the output determined by the <em>watching</em> order itself (nothing to do with the order of the options <codeclass="docutils literal notranslate"><spanclass="pre">-b</span><spanclass="pre">-s</span></code>).</p></li>
<h3>Use <codeclass="docutils literal notranslate"><spanclass="pre">-x</span></code> to check more details<aclass="headerlink"href="#use-x-to-check-more-details"title="Permalink to this headline">¶</a></h3>
<h3>Use condition expressions to locate specific call<aclass="headerlink"href="#use-condition-expressions-to-locate-specific-call"title="Permalink to this headline">¶</a></h3>
<h3>Check <codeclass="docutils literal notranslate"><spanclass="pre">exceptions</span></code><aclass="headerlink"href="#check-exceptions"title="Permalink to this headline">¶</a></h3>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">#cost>200</span></code> (<codeclass="docutils literal notranslate"><spanclass="pre">ms</span></code>) filter out all invokings that take less than <codeclass="docutils literal notranslate"><spanclass="pre">200ms</span></code>.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">target</span></code> is the <codeclass="docutils literal notranslate"><spanclass="pre">this</span></code> object in java.</p></li>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.