Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2010-06-25 15:18:12 -0400
committereutarass2010-06-25 15:18:12 -0400
commit33c8245e740541273f4fb63713e4dcda0113ec8e (patch)
tree837662b897f63026cfbb369b0e7238b9348c29a7 /plugins/org.eclipse.tm.tcf
parent63dd381c3890711e470633c188c3096dd32f0f43 (diff)
downloadorg.eclipse.tcf-33c8245e740541273f4fb63713e4dcda0113ec8e.tar.gz
org.eclipse.tcf-33c8245e740541273f4fb63713e4dcda0113ec8e.tar.xz
org.eclipse.tcf-33c8245e740541273f4fb63713e4dcda0113ec8e.zip
Bug 317813: Add Discovery tracing in Java reference implementation
Diffstat (limited to 'plugins/org.eclipse.tm.tcf')
-rw-r--r--plugins/org.eclipse.tm.tcf/.options2
-rw-r--r--plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/Activator.java30
2 files changed, 27 insertions, 5 deletions
diff --git a/plugins/org.eclipse.tm.tcf/.options b/plugins/org.eclipse.tm.tcf/.options
new file mode 100644
index 000000000..38d422df7
--- /dev/null
+++ b/plugins/org.eclipse.tm.tcf/.options
@@ -0,0 +1,2 @@
+org.eclipse.tm.tcf/debug = false
+org.eclipse.tm.tcf/debug/discovery = false
diff --git a/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/Activator.java b/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/Activator.java
index 2bbdc981e..a106d9c42 100644
--- a/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/Activator.java
+++ b/plugins/org.eclipse.tm.tcf/src/org/eclipse/tm/tcf/Activator.java
@@ -49,6 +49,9 @@ public class Activator extends Plugin {
}
};
+ /** Eclipse tracing option, plug-in wide */
+ private static boolean TRACE;
+
/**
* Constructor.
*/
@@ -73,17 +76,34 @@ public class Activator extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
debug = Platform.inDebugMode();
+
+ TRACE = "true".equals(Platform.getDebugOption("org.eclipse.tm.tcf/debug")); //$NON-NLS-1$
+ if (TRACE && "true".equals(Platform.getDebugOption("org.eclipse.tm.tcf/debug/discovery"))) {
+ System.setProperty("org.eclipse.tm.tcf.core.tracing.discovery", "true");
+ }
+
ChannelTCP.setSSLContext(TCFSecurityManager.createSSLContext());
Protocol.setLogger(new ILogger() {
public void log(String msg, Throwable x) {
- if (debug) {
- System.err.println(msg);
+ // Normally, we hook the TCF logging service (ILogger) to the
+ // Plug-in logger. Trace hooks in the code use the TCF logger.
+ // The Plug-in logger isn't really designed for large amounts of
+ // trace data, though, so redirect to stdout when tracing is
+ // enabled.
+ if (TRACE) {
+ System.out.println(msg);
if (x != null) x.printStackTrace();
}
- if (plugin != null && getLog() != null) {
- getLog().log(new Status(IStatus.ERROR,
- getBundle().getSymbolicName(), IStatus.OK, msg, x));
+ else {
+ if (debug) {
+ System.err.println(msg);
+ if (x != null) x.printStackTrace();
+ }
+ if (plugin != null && getLog() != null) {
+ getLog().log(new Status(IStatus.ERROR,
+ getBundle().getSymbolicName(), IStatus.OK, msg, x));
+ }
}
}
});

Back to the top