Jump to: navigation, search

Difference between revisions of "ETrice/Development/Tips and tricks"

(Add Tracing to Your Plug-in)
(Add Tracing to Your Plug-in)
Line 2: Line 2:
  
 
== Add Tracing to Your Plug-in ==
 
== Add Tracing to Your Plug-in ==
 +
 +
Add a file {{{.option}}} on the top level of your plug-in project. To this file add a line
 +
<pre>
 +
de.protos.example/trace/data=true
 +
</pre>
 +
 +
This setting can be toggled in the trace tab of your launch configuration (it's also possible to edit string values there).
 +
 +
Here is the source code that uses these settings to enable trace messages printed to system log or standard out:
  
 
<source lang="Java">
 
<source lang="Java">

Revision as of 02:43, 16 July 2012

General Eclipse HOWTOs

Add Tracing to Your Plug-in

Add a file {{{.option}}} on the top level of your plug-in project. To this file add a line

de.protos.example/trace/data=true

This setting can be toggled in the trace tab of your launch configuration (it's also possible to edit string values there).

Here is the source code that uses these settings to enable trace messages printed to system log or standard out:

	private static boolean traceData = false;
 
	static {
		if (Activator.getDefault().isDebugging()) {
			String value = Platform.getDebugOption(
					"de.protos.example/trace/data");
			if (value!=null && value.equalsIgnoreCase(Boolean.toString(true)))
				traceData = true;
		}
	}