mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 22:32:06 +01:00
Updates the document with information about the new debugger
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2248 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
9f0f4aeae6
commit
bbcc5358e9
1 changed files with 68 additions and 19 deletions
|
@ -15,32 +15,17 @@ Debugging with Smack
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Smack includes a built-in debugging console that will let you track all XML traffic between
|
Smack includes two built-in debugging consoles that will let you track all XML traffic between
|
||||||
the client and server.
|
the client and server. A <a href="#lite">lite debugger</a> which is part of the <tt>smack.jar</tt>
|
||||||
|
and an <a href="#enhanced">enhanced debugger</a> contained in <tt>smackx-debug.jar</tt>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
|
||||||
When debugging mode is enabled, a debug window will appear when each new connection is created.
|
|
||||||
The window will contain the following information:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<img src="images/debugwindow.gif" width="359" height="399" alt="" border="0" align="right">
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Client Traffic (red text) -- raw XML traffic generated by Smack and sent to the server.
|
|
||||||
<li>Server Traffic (blue text) -- raw XML traffic sent by the server to the client.
|
|
||||||
<li>Interpreted Packets (green text) -- shows XML packets from the server as parsed by Smack.
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
Right click on any of the panes to bring up a menu with the choices to copy of the contents
|
|
||||||
to the system clipboard or to clear the contents of the pane.
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Debugging mode can be enabled in two different ways:
|
Debugging mode can be enabled in two different ways:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>Add the following line of code before creating new connections:<p>
|
<li>Add the following line of code <b>before</b> creating new connections:<p>
|
||||||
<tt>XMPPConnection.DEBUG_ENABLED = true;</tt><p>
|
<tt>XMPPConnection.DEBUG_ENABLED = true;</tt><p>
|
||||||
|
|
||||||
<li>Set the Java system property <tt>smack.debugEnabled</tt> to true. The
|
<li>Set the Java system property <tt>smack.debugEnabled</tt> to true. The
|
||||||
|
@ -57,6 +42,70 @@ add the following line to your application before opening new connections:
|
||||||
<tt>XMPPConnection.DEBUG_ENABLED = false;</tt>
|
<tt>XMPPConnection.DEBUG_ENABLED = false;</tt>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Smack uses the following logic to decide the debugger console to use:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>It will first try use the debugger class specified in the Java system property
|
||||||
|
<tt>smack.debuggerClass</tt>. This is a good place if you want to hook your own
|
||||||
|
debugger console. If you need to develop your own debugger all you need to do is
|
||||||
|
implement the <tt>SmackDebugger</tt> interface and then set the system property
|
||||||
|
on the command line such as:<p>
|
||||||
|
<tt>java -Dsmack.debuggerClass=my.company.com.MyDebugger SomeApp </tt><p>
|
||||||
|
|
||||||
|
<li>If step 1 fails then the next option is to try to use the enhanced debugger. The
|
||||||
|
file <tt>smackx-debug.jar</tt> contains the enhanced debugger. Therefore you will need
|
||||||
|
to place the jar file in the classpath. For situations where space is an issue you
|
||||||
|
may want to only deploy <tt>smack.jar</tt> in which case the enhanced debugger won't be
|
||||||
|
available.<p>
|
||||||
|
|
||||||
|
<li>The last option if the previous two steps fail is to use the lite debugger. The lite
|
||||||
|
debugger is a very good option for situations where you need to have low memory footprint.
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<p class="subheader">
|
||||||
|
<a name="enhanced">Enhanced Debugger</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
When debugging mode is enabled, a debug window will appear containing tabs for each new created connection.
|
||||||
|
The window will contain the following information:
|
||||||
|
|
||||||
|
<img src="images/enhanceddebugger.png" width="479" height="400" alt="" border="0" align="right">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Connection tabs -- each tab shows debugging information related to the connection.
|
||||||
|
<li>Smack info tab -- shows information about Smack (e.g. Smack version, installed components, etc.).
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
The connection tab will contain the following information:
|
||||||
|
<ul>
|
||||||
|
<li>All Packets -- shows sent and received packets information parsed by Smack.
|
||||||
|
<li>Raw Sent Packets -- raw XML traffic generated by Smack and sent to the server.
|
||||||
|
<li>Raw Received Packets -- raw XML traffic sent by the server to the client.
|
||||||
|
<li>Ad-hoc message -- allows to send ad-hoc packets of any type.
|
||||||
|
<li>Information -- shows connection state and statistics.
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p class="subheader">
|
||||||
|
<a name="lite">Lite Debugger</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
When debugging mode is enabled, a debug window will appear when each new connection is created.
|
||||||
|
The window will contain the following information:
|
||||||
|
|
||||||
|
|
||||||
|
<img src="images/debugwindow.gif" width="359" height="399" alt="" border="0" align="right">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Client Traffic (red text) -- raw XML traffic generated by Smack and sent to the server.
|
||||||
|
<li>Server Traffic (blue text) -- raw XML traffic sent by the server to the client.
|
||||||
|
<li>Interpreted Packets (green text) -- shows XML packets from the server as parsed by Smack.
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
Right click on any of the panes to bring up a menu with the choices to copy of the contents
|
||||||
|
to the system clipboard or to clear the contents of the pane.
|
||||||
|
|
||||||
<br clear="all" /><br><br>
|
<br clear="all" /><br><br>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
|
|
Loading…
Reference in a new issue