How to debug your Extensions

You can easily attach a Remote Debugger to the server and enable your favorite Debugger for bug hunting in your Extensions.

SmartFoxServer 2X can be started with the sfs2x.bat (Windows) or sfs2x.sh (Linux/Unix/MacOSX) scripts. By adding some JVM switches to the launch script you can enable remote debugging. You can do it by following these steps:

  • open the AdminTool’s Server Configurator module and go to the JVM settings tab;
  • add the following switches to the JVM options list:
    -Xdebug
    -Xnoagent
    -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
  • submit the changes and restart SmartFoxServer: now you will be able to start a remote debugging session.

If you want to keep the script allowing debug separate from the standard start script, simply duplicate the start script and modify it by adding the above switches using a text editor. Then save the script as debug.sh ordebug.bat and launch it.