* [sc](sc.md) - check the info for the classes loaded by JVM
* [sc](sc.md) - check profiles of the classes loaded by JVM
* [sm](sm.md) - check methods info for the loaded classes
* [sm](sm.md) - check methods' profile
* [dump](dump.md) - dump the loaded classes in byte code to the specified location
* [dump](dump.md) - dump out the byte code of the loaded classes to specified location
* [redefine](redefine.md) - load external `*.class` files and re-define it into JVM
* [redefine](redefine.md) - load external `*.class` files and re-define the JVM-loaded classes
* [jad](jad.md) - de-compile the specified loaded classes
* [jad](jad.md) - de-compile the specified loaded classes
* [classloader](classloader.md) - check the inheritance structure, urls, class loading info of class cloader; using classloader to get the url of the resource e.g. `java/lang/String.class`
* [classloader](classloader.md) - check the inheritance structure, urls, class loading info for the specified class; using classloader to get the url of the resource e.g. `java/lang/String.class`
## monitor/watch/trace - related
## monitor/watch/trace - related
> **Attention**: commands here are taking advantage of `byte code injection`, which means we are using [AOP](https://en.wikipedia.org/wiki/Aspect-oriented_programming) to monitor and analyze the classes. So when using it for online troubleshooting, you'd better *explicitly specifically* specify the classes and also remember to remove the injected code by `shutdown` or `reset`.
> **Attention**: commands here are taking advantage of byte-code-injection, which means we are injecting some [aspects](https://en.wikipedia.org/wiki/Aspect-oriented_programming) into the current classes for monitoring and statistics purpose. Therefore when use it for online troubleshooting in your production environment, you'd better **explicitly specify** classes/methods/criteria, and remember to remove the injected code by `shutdown` or `reset`.
* [watch](watch.md) - watch/monitor methods in data aspect including `return values`, `exceptions` and `parameters`
* [watch](watch.md) - display the input/output parameter, return object, and thrown exception of specified method invocation
* [trace](trace.md) - track the method calling trace along with the time cost for each call
* [trace](trace.md) - trace the execution time of specified method invocation
* [stack](stack.md) - print the call stack trace of the current method in a persistent way
* [stack](stack.md) - display the stack trace for the specified class and method
* [tt](tt.md) - record the arguments and returned value for the methods, history included
* [tt](tt.md) - time tunnel, record the arguments and returned value for the methods and replay
## options
## options
* [options](options.md) - check or set Arthas global options
* [options](options.md) - check/set Arthas global options
## pipe
## pipe
`pipe` is supported in Arthas, e.g. `sm org.apache.log4j.Logger | grep <init>`
Arthas provides `pipe` to process the result returned from commands further, e.g. `sm org.apache.log4j.Logger | grep <init>`. Commands supported in `pipe`:
Commands supported in `pipe`:
* grep - filtering
* grep - filter the result with the given keyword
* plaintext - remove the color
* plaintext - remove the color
* wc - line counting
* wc - count lines
## async in background
## async in background
[async](async.md) will be a great help, when the `incident` seldom occurs and you are [`watch`](watch.md)ing it.
[async](async.md) can be handy when a problem is hardly to reproduce in the production enviornment, e.g. one `watch` condition may happen only once in one single day.
* job control - use `>` to redirect result into the log file, use `&` to put the job to the background. Job keeps running even if the session is disconnected (the session lifecycle is 1 day by default)
* jobs - list all jobs
* jobs - list all jobs
* kill - forcibly terminate the job
* kill - forcibly terminate the job
* fg - bring the paused job back to the front
* fg - bring the suspend job to the foreground
* bg - put the paused job to the background
* bg - put the job to run in the background
* tips - a) use `>` to redirect the output; b) use `&` to put the job to the background; c) disconnecting the session will not influence the job (the default life is 1 day)
## Web Console
Arthas supports living inside a browser. The communication between arthas and browser is via websocket.
* [Web Console](web-console.md)
## Others
## Other features
* [Web Console](web-console.md) - using websocket to connect Arthas
* [Async support](async.md)
* [log the output](save-log.md)
* [log the output](save-log.md)
* [batch](batch-support.md)
* [batch](batch-support.md)
* [how to use ognl](https://github.com/alibaba/arthas/issues/11)
* [how to use ognl](https://github.com/alibaba/arthas/issues/11)
Print out the full call stack trace containing the current method.
Print out the full call stack trace *till* the current method.
Most of the time, we know the method being invoked but not always we know **HOW being invoked**; `stack` can be a great help to locate the *source* for you.
Most of the time, we know the method being invoked but not always we know **HOW being invoked**; `stack` can be a great help to locate the *source* for you.
<spanid="basic"></span><h2>Basic<aclass="headerlink"href="#basic"title="Permalink to this headline">¶</a></h2>
<spanid="basic"></span><h2>Basic<aclass="headerlink"href="#basic"title="Permalink to this headline">¶</a></h2>
<ulclass="simple">
<ulclass="simple">
<li>help - show help info</li>
<li>help - display Arthas help</li>
<li>cls - clear out the current screen</li>
<li>cls - clear the screen</li>
<li>session - check details of the current session</li>
<li>session - display current session information</li>
<li><aclass="reference internal"href="reset.html"><spanclass="doc">reset</span></a> - reset all injected/enhanced classes</li>
<li><aclass="reference internal"href="reset.html"><spanclass="doc">reset</span></a> - reset all the enhanced classes. All enhanced classes will also be reset when Arthas server is closed by <codeclass="docutils literal notranslate"><spanclass="pre">shutdown</span></code></li>
<li>version - print the version of the Arthas attaching to the current target process</li>
<li>version - print the version for the Arthas attached to the current Java process</li>
<li>quit/exit - exit the current Arthas client without affecting other clients</li>
<li>quit/exit - exit the current Arthas session, without effecting other sessions</li>
<li>shutdown - terminate the Arthas server and all clients</li>
<li>shutdown - terminate the Arthas server, all Arthas sessions will be destroyed</li>
<li><aclass="reference internal"href="keymap.html"><spanclass="doc">keymap</span></a> - keymap for Arthas keyboard shortcut</li>
</ul>
</ul>
</div>
</div>
<divclass="section"id="jvm">
<divclass="section"id="jvm">
<spanid="jvm"></span><h2>JVM<aclass="headerlink"href="#jvm"title="Permalink to this headline">¶</a></h2>
<spanid="jvm"></span><h2>JVM<aclass="headerlink"href="#jvm"title="Permalink to this headline">¶</a></h2>
<ulclass="simple">
<ulclass="simple">
<li><aclass="reference internal"href="dashboard.html"><spanclass="doc">dashboard</span></a> - real-time dashboard for the current system</li>
<li><aclass="reference internal"href="dashboard.html"><spanclass="doc">dashboard</span></a> - dashboard for the system’s real-time data</li>
<li><aclass="reference internal"href="jvm.html"><spanclass="doc">jvm</span></a> - show JVM information</li>
<li><aclass="reference internal"href="sysprop.html"><spanclass="doc">sysprop</span></a> - check or modify JVM system properties</li>
<li><aclass="reference internal"href="sysprop.html"><spanclass="doc">sysprop</span></a> - show/modify system properties</li>
<li><strong>New!</strong><aclass="reference internal"href="getstatic.html"><spanclass="doc">getstatic</span></a> :clap: - check the static properties of classes</li>
<li><aclass="reference internal"href="sm.html"><spanclass="doc">sm</span></a> - check methods info for the loaded classes</li>
<li><aclass="reference internal"href="dump.html"><spanclass="doc">dump</span></a> - dump out the byte code of the loaded classes to specified location</li>
<li><aclass="reference internal"href="dump.html"><spanclass="doc">dump</span></a> - dump the loaded classes in byte code to the specified location</li>
<li><aclass="reference internal"href="redefine.html"><spanclass="doc">redefine</span></a> - load external <codeclass="docutils literal notranslate"><spanclass="pre">*.class</span></code> files and re-define the JVM-loaded classes</li>
<li><aclass="reference internal"href="redefine.html"><spanclass="doc">redefine</span></a> - load external <codeclass="docutils literal notranslate"><spanclass="pre">*.class</span></code> files and re-define it into JVM</li>
<li><aclass="reference internal"href="jad.html"><spanclass="doc">jad</span></a> - de-compile the specified loaded classes</li>
<li><aclass="reference internal"href="jad.html"><spanclass="doc">jad</span></a> - de-compile the specified loaded classes</li>
<li><aclass="reference internal"href="classloader.html"><spanclass="doc">classloader</span></a> - check the inheritance structure, urls, class loading info of class cloader; using classloader to get the url of the resource e.g. <codeclass="docutils literal notranslate"><spanclass="pre">java/lang/String.class</span></code></li>
<li><aclass="reference internal"href="classloader.html"><spanclass="doc">classloader</span></a> - check the inheritance structure, urls, class loading info for the specified class; using classloader to get the url of the resource e.g. <codeclass="docutils literal notranslate"><spanclass="pre">java/lang/String.class</span></code></li>
<spanid="monitor-watch-trace-related"></span><h2>monitor/watch/trace - related<aclass="headerlink"href="#monitor-watch-trace-related"title="Permalink to this headline">¶</a></h2>
<spanid="monitor-watch-trace-related"></span><h2>monitor/watch/trace - related<aclass="headerlink"href="#monitor-watch-trace-related"title="Permalink to this headline">¶</a></h2>
<blockquote>
<blockquote>
<div><strong>Attention</strong>: commands here are taking advantage of <codeclass="docutils literal notranslate"><spanclass="pre">byte</span><spanclass="pre">code</span><spanclass="pre">injection</span></code>, which means we are using<aclass="reference external"href="https://en.wikipedia.org/wiki/Aspect-oriented_programming">AOP</a> to monitor and analyze the classes. So when using it for online troubleshooting, you’d better <em>explicitly specifically</em> specify the classes and also remember to remove the injected code by <codeclass="docutils literal notranslate"><spanclass="pre">shutdown</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">reset</span></code>.</div></blockquote>
<div><strong>Attention</strong>: commands here are taking advantage of byte-code-injection, which means we are injecting some<aclass="reference external"href="https://en.wikipedia.org/wiki/Aspect-oriented_programming">aspects</a> into the current classes for monitoring and statistics purpose. Therefore when use it for online troubleshooting in your production environment, you’d better <strong>explicitly specify</strong> classes/methods/criteria, and remember to remove the injected code by <codeclass="docutils literal notranslate"><spanclass="pre">shutdown</span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">reset</span></code>.</div></blockquote>
<li><aclass="reference internal"href="watch.html"><spanclass="doc">watch</span></a> - watch/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></li>
<li><aclass="reference internal"href="watch.html"><spanclass="doc">watch</span></a> - display the input/output parameter, return object, and thrown exception of specified method invocation</li>
<li><aclass="reference internal"href="trace.html"><spanclass="doc">trace</span></a> - track the method calling trace along with the time cost for each call</li>
<li><aclass="reference internal"href="trace.html"><spanclass="doc">trace</span></a> - trace the execution time of specified method invocation</li>
<li><aclass="reference internal"href="stack.html"><spanclass="doc">stack</span></a> - print the call stack trace of the current method in a persistent way</li>
<li><aclass="reference internal"href="stack.html"><spanclass="doc">stack</span></a> - display the stack trace for the specified class and method</li>
<li><aclass="reference internal"href="tt.html"><spanclass="doc">tt</span></a> - record the arguments and returned value for the methods, history included</li>
<li><aclass="reference internal"href="tt.html"><spanclass="doc">tt</span></a> - time tunnel, record the arguments and returned value for the methods and replay</li>
</ul>
</ul>
</div>
</div>
<divclass="section"id="options">
<divclass="section"id="options">
<spanid="options"></span><h2>options<aclass="headerlink"href="#options"title="Permalink to this headline">¶</a></h2>
<spanid="options"></span><h2>options<aclass="headerlink"href="#options"title="Permalink to this headline">¶</a></h2>
<ulclass="simple">
<ulclass="simple">
<li><aclass="reference internal"href="options.html"><spanclass="doc">options</span></a> - check or set Arthas global options</li>
<li><aclass="reference internal"href="options.html"><spanclass="doc">options</span></a> - check/set Arthas global options</li>
</ul>
</ul>
</div>
</div>
<divclass="section"id="pipe">
<divclass="section"id="pipe">
<spanid="pipe"></span><h2>pipe<aclass="headerlink"href="#pipe"title="Permalink to this headline">¶</a></h2>
<spanid="pipe"></span><h2>pipe<aclass="headerlink"href="#pipe"title="Permalink to this headline">¶</a></h2>
<p><codeclass="docutils literal notranslate"><spanclass="pre">pipe</span></code> is supported in Arthas, e.g. <codeclass="docutils literal notranslate"><spanclass="pre">sm</span><spanclass="pre">org.apache.log4j.Logger</span><spanclass="pre">|</span><spanclass="pre">grep</span><spanclass="pre"><init></span></code></p>
<p>Arthas provides <codeclass="docutils literal notranslate"><spanclass="pre">pipe</span></code> to process the result returned from commands further, e.g. <codeclass="docutils literal notranslate"><spanclass="pre">sm</span><spanclass="pre">org.apache.log4j.Logger</span><spanclass="pre">|</span><spanclass="pre">grep</span><spanclass="pre"><init></span></code>. Commands supported in <codeclass="docutils literal notranslate"><spanclass="pre">pipe</span></code>:</p>
<p>Commands supported in <codeclass="docutils literal notranslate"><spanclass="pre">pipe</span></code>:</p>
<ulclass="simple">
<ulclass="simple">
<li>grep - filtering</li>
<li>grep - filter the result with the given keyword</li>
<li>plaintext - remove the color</li>
<li>plaintext - remove the color</li>
<li>wc - line counting</li>
<li>wc - count lines</li>
</ul>
</ul>
</div>
</div>
<divclass="section"id="async-in-background">
<divclass="section"id="async-in-background">
<spanid="async-in-background"></span><h2>async in background<aclass="headerlink"href="#async-in-background"title="Permalink to this headline">¶</a></h2>
<spanid="async-in-background"></span><h2>async in background<aclass="headerlink"href="#async-in-background"title="Permalink to this headline">¶</a></h2>
<p><aclass="reference internal"href="async.html"><spanclass="doc">async</span></a>will be a great help, when the <codeclass="docutils literal notranslate"><spanclass="pre">incident</span></code> seldom occurs and you are <aclass="reference external"href="watch.md"><codeclass="docutils literal notranslate"><spanclass="pre">watch</span></code></a>ing it.</p>
<p><aclass="reference internal"href="async.html"><spanclass="doc">async</span></a>can be handy when a problem is hardly to reproduce in the production enviornment, e.g. one <codeclass="docutils literal notranslate"><spanclass="pre">watch</span></code> condition may happen only once in one single day.</p>
<ulclass="simple">
<ulclass="simple">
<li>job control - use <codeclass="docutils literal notranslate"><spanclass="pre">></span></code> to redirect result into the log file, use <codeclass="docutils literal notranslate"><spanclass="pre">&</span></code> to put the job to the background. Job keeps running even if the session is disconnected (the session lifecycle is 1 day by default)</li>
<li>jobs - list all jobs</li>
<li>jobs - list all jobs</li>
<li>kill - forcibly terminate the job</li>
<li>kill - forcibly terminate the job</li>
<li>fg - bring the paused job back to the front</li>
<li>fg - bring the suspend job to the foreground</li>
<li>bg - put the paused job to the background</li>
<li>bg - put the job to run in the background</li>
<li>tips - a) use <codeclass="docutils literal notranslate"><spanclass="pre">></span></code> to redirect the output; b) use <codeclass="docutils literal notranslate"><spanclass="pre">&</span></code> to put the job to the background; c) disconnecting the session will not influence the job (the default life is 1 day)</li>
</ul>
</ul>
</div>
</div>
<divclass="section"id="others">
<divclass="section"id="web-console">
<spanid="others"></span><h2>Others<aclass="headerlink"href="#others"title="Permalink to this headline">¶</a></h2>
<spanid="web-console"></span><h2>Web Console<aclass="headerlink"href="#web-console"title="Permalink to this headline">¶</a></h2>
<ulclass="simple">
<p>Arthas supports living inside a browser. The communication between arthas and browser is via websocket.</p>
<li><aclass="reference internal"href="web-console.html"><spanclass="doc">Web Console</span></a> - using websocket to connect Arthas</li>
<divclass="toctree-wrapper compound">
<li><aclass="reference internal"href="save-log.html"><spanclass="doc">log the output</span></a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#use-to-run-the-command-in-the-background">1. Use & to run the command in the background</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#list-background-jobs">2. List background jobs</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#suspend-and-cannel-job">3. Suspend and Cannel job</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#fg-bg-bring-a-background-job-to-the-foreground-restart-a-stopped-background-job">4. fg/bg, Bring a background job to the foreground/Restart a stopped background job</a></li>
<liclass="toctree-l4"><aclass="reference internal"href="#redirect-the-job-output">5. Redirect the job output</a></li>
<spanid="stack"></span><h1>stack<aclass="headerlink"href="#stack"title="Permalink to this headline">¶</a></h1>
<spanid="stack"></span><h1>stack<aclass="headerlink"href="#stack"title="Permalink to this headline">¶</a></h1>
<p>Print out the full call stack trace containing the current method.</p>
<p>Print out the full call stack trace <em>till</em> the current method.</p>
<p>Most of the time, we know the method being invoked but not always we know <strong>HOW being invoked</strong>; <codeclass="docutils literal notranslate"><spanclass="pre">stack</span></code> can be a great help to locate the <em>source</em> for you.</p>
<p>Most of the time, we know the method being invoked but not always we know <strong>HOW being invoked</strong>; <codeclass="docutils literal notranslate"><spanclass="pre">stack</span></code> can be a great help to locate the <em>source</em> for you.</p>
<divclass="section"id="parameters">
<divclass="section"id="parameters">
<spanid="parameters"></span><h2>Parameters<aclass="headerlink"href="#parameters"title="Permalink to this headline">¶</a></h2>
<spanid="parameters"></span><h2>Parameters<aclass="headerlink"href="#parameters"title="Permalink to this headline">¶</a></h2>
<spanid="check-context-of-the-call"></span><h2>Check context of the call<aclass="headerlink"href="#check-context-of-the-call"title="Permalink to this headline">¶</a></h2>
<spanid="check-context-of-the-call"></span><h2>Check context of the call<aclass="headerlink"href="#check-context-of-the-call"title="Permalink to this headline">¶</a></h2>
<p>Using <codeclass="docutils literal notranslate"><spanclass="pre">tt</span><spanclass="pre">-i</span><spanclass="pre"><index></span></code> to check a specific record.</p>
<p>Using <codeclass="docutils literal notranslate"><spanclass="pre">tt</span><spanclass="pre">-i</span><spanclass="pre"><index></span></code> to check a specific calling details.</p>
<spanid="web-console"></span><h1>Web Console<aclass="headerlink"href="#web-console"title="Permalink to this headline">¶</a></h1>
<spanid="web-console"></span><h1>Web Console<aclass="headerlink"href="#web-console"title="Permalink to this headline">¶</a></h1>
<p>Arthas supports the Web Console. After attach success, the user can access: [http://localhost:8563/] (http://localhost:8563/).</p>
<p>Arthas supports the Web Console. After attach success, the user can access: <aclass="reference external"href="http://localhost:8563/">http://localhost:8563/</a>.</p>
<p>The user can fill in the IP and connect the remote arthas on other machines.</p>
<p>The user can fill in the IP and connect the remote arthas on other machines.</p>
<p>If you have suggestions for the Web Console, please leave a message here: <aclass="reference external"href="https://github.com/alibaba/arthas/issues/15">https://github.com/alibaba/arthas/issues/15</a></p>
<p>If you have suggestions for the Web Console, please leave a message here: <aclass="reference external"href="https://github.com/alibaba/arthas/issues/15">https://github.com/alibaba/arthas/issues/15</a></p>