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.
In order to support tracing without the need to edit the tracing .options files, PDE provides a "Runtime Tracing" tab in the launch dialog. All the tracing settings are saved in the launch configuration. This means that you can create several configurations with different tracing options and alternate between them.
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 the Workspace Plug-ins group) and your tracing properties will appear in the property sheet.
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. PDE will immediately detect this file and include it in the list of "Workspace Plug-ins" on the advanced tracing preference page.
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 under "Workspace Plug-ins". When selected, it should show the newly defined flags with their default values.
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().