Servoy comes with a full-featured debugging environment to allow developers to debug their script logic using debug clients, including the Smart Client and Web Client.
This chapter provides a general overview of the debugging process, followed by a description of features available in the Debug perspective.

Getting Started

Debugging uses the following general process: (1) starting a Servoy client, (2) setting breakpoints for errors detected, then (3) switching to the Debug perspective to proceed with debugging.

1. Starting a Servoy Client
Servoy solutions can be tested in the desired environment by launching the (1) Smart Client or (2) Web Client (see image).
Clicking on either button launches the Servoy client for the currently active solution.

2. Setting Breakpoints
When an error is encountered while running a Servoy client, developers can set breakpoints for methods in the script that they wish to debug.
Breakpoints can be added to any open script file, regardless of whether or not a Servoy client is running. To add breakpoints:

  1. Open the script that you wish to debug in Script Editor.
  2. Double-click on the left side bar to add a breakpoint to the specific line in the method you that would like to debug.
  3. Repeat the process to add breakpoints as needed.

    Note: To remove breakpoints, simply double-click on the breakpoint again.

3. Switching to the Debug Perspective
When a breakpoint is reached while using the Servoy client, a prompt will appear, asking you to confirm that you want to switch to the Debug Perspective. At this point, you can select the option to "Remember my decision."
You can then continue with the debugging process in the Debug Perspective.

Note: You also can start debugging at a specific method within the script using the following steps:

  1. Open the script in Script Editor
  2. Set the breakpoint for the method, if one has not been set.
  3. In the Solution Explorer contextual list, right-click the desired method.
  4. Select Debug method. 
    This will take you to the Debug perspective, with the particular method being debugged highlighted.
    This procedure is only available once a Servoy client has been started.

Note: You can switch between the Debug and Servoy Design perspectives at any time using the following methods:

  • Via the Window menu item>Open Perspective>Debug
  • By clicking on the Open Perspective Icon at the top right corner of the Servoy Design Perspective (see image).

You can then continue with the debugging process in the Debug Perspective.

The Debug Perspective

The Debug perspective contains the following views, divided into five main areas, described below from left to right and top to bottom.

  1. Debug and Interactive Console
  1. Variables, Breakpoints, and Expressions
  1. Editors
  1. Outline
  1. Console and Profiler

Working With Breakpoints

The following properties can be assigned for a selected breakpoint using the context menu item Breakpoint Properties, accessed by right-clicking on the desired breakpoint in the editor view or the Breakpoints view:

  1. Delete selected breakpoint.
  2. Delete all breakpoints (Caution: Breakpoints in all open editors will be deleted.)
  3. Show breakpoints supported by selected target (shows only the breakpoints for the currently selected script editor view).
  4. Go to file for breakpoint (goes to breakpoint location in Script editor).
  5. Skip all breakpoints at runtime.
  6. Toggle Global ExceptionBreak (only stops the process and shows the breakpoint when an error occurs)
  7. Toggle Global EntryBreak (breaks the process every time a method attempts to execute, with or without a breakpoint)
  8. Toggle Global ExitBreak (breaks the process after the execution of a method, with or without a breakpoint)
  9. Expand all
  10. Collapse all
  11. Link with Debug view (highlights the selected breakpoint in the Debug script editor view)

Accessing Log Files

During debugging, Servoy Developer logs the activities of the debug client in the following file:
../application_server/servoy_log.txt
An additional (external) console window providing more detailed information can be launched by Eclipse by adding "-consoleLog" to the top of the servoy.ini file (for Mac users, this file is exposed when you view the Servoy application package contents and browse to the MacOS folder.) This console is useful for getting additional feedback during debugging.