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.
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:
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:
Note: You can switch between the Debug and Servoy Design perspectives at any time using the following methods:
You can then continue with the debugging process in 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.
Note: In Eclipse, you can also open the Command Console view to interact with the client. * The command console links to the specific client being run and evaluates code on top level within solution (as opposed to the Interactive Console, which evaluates on a line-by-line level). When two clients are active, e.g. the Smart Client and Web Client, the command console allows you switch between active clients.
Note: If a desired view is not visible in your Debug perspective, you can open it using the main menu item Window>Show View (Popular debug views are shown in this menu; clicking Other opens a browser that allows you to search all available views).
Note: Many of these views have context-specific toolbars located at the top right of the view that allow easy access to commonly used functions within the view. Users can also access view options by clicking on the inverted triangle found at the top right corner of the view.
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:
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.