Debugging with Smack

Smack includes a built-in debugging console that will let you track all XML traffic between the client and server.

When debugging mode is enabled, a debug window will appear when each new connection is created. The window will contain the following information:

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.

Debugging mode can be enabled in two different ways:

  1. Add the following line of code before creating new connections:

    XMPPConnection.DEBUG_ENABLED = true;

  2. Set the Java system property smack.debugEnabled to true. The system property can be set on the command line such as:

    java -Dsmack.debugEnabled=true SomeApp

If you wish to explicitly disable debug mode in your application, including using the command-line parameter, add the following line to your application before opening new connections:

XMPPConnection.DEBUG_ENABLED = false;