Running with tracing

The platform provides a mechanism for tracking the activity of your plug-in at runtime without full debugging. It allows you to use tracing flags that will cause tracing information to be printed on the standard output (or Console view). These flags are defined in files named ".options" and have the following syntax:

   <plug-in Id>/debug = true/false  (master switch)
   <plug-in Id>/<tracing flag> = <value>

The first entry represents master switch for tracing your plug-in. If you call the method isDebugging in your plug-in class, it will return true if the value of this tracing variable is true. Other tracing flags are defined by you and their value can be obtained by using

   Platform.getDebugOption(optionName);

Most of the platform plug-ins define tracing flags, particularly the platform core. For a new plug-in developer, the most interesting set of tracing flags are those related to class loading, because they can allow tracing of plug-in loading problems.

Run-time workbench launcher - tracing

Example:  Adding tracing support to your plug-in

If you add tracing support to the plug-in under development, your plug-ins will appear in the list of plug-ins that support tracing.

In order to allow other developers to control your plug-in's tracing flags, you need to make these options known.  This is typically done by placing a .options file in your plug-in.  The file lists all the supported flags as well as their default values.

We will now define a template .options file with a few tracing flags for our new plug-in.

Select the com.example.xyz project created earlier and create a new file .options. When the default text editor opens, add the following entries:

   com.example.xyz/debug = true
   com.example.xyz/debug/flag = true
   com.example.xyz/debug/filter = *

When this file is saved, select Run > Run... to open the launch dialog. Our plug-in should now show up in the list. When selected, it should show the newly defined flags with their default values.

Run-time workbench launcher - tracing example

Creating the .options file only defines the availability flags, allowing other plug-in developers to define the values of the tracing properties.  You will still need to check the values of your tracing properties in your plug-in code using Platform.getDebugOption().