diff options
author | Uwe Stieber | 2014-06-14 09:39:39 +0000 |
---|---|---|
committer | Uwe Stieber | 2014-06-14 09:39:39 +0000 |
commit | 179d08d66ff3f8651b5979af533c0a2dcf1e7730 (patch) | |
tree | 37b9bcd79d251db42f24ad3f438dd92a01297e82 | |
parent | 96c63aece93179144ed91023d7c1eb1a0cdac966 (diff) | |
download | org.eclipse.tcf-179d08d66ff3f8651b5979af533c0a2dcf1e7730.tar.gz org.eclipse.tcf-179d08d66ff3f8651b5979af533c0a2dcf1e7730.tar.xz org.eclipse.tcf-179d08d66ff3f8651b5979af533c0a2dcf1e7730.zip |
Target Explorer: Add additional tracing output to value-add launcher
4 files changed, 52 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java index 607ad6912..946b2c227 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java @@ -846,10 +846,18 @@ public final class ChannelManager extends PlatformObject implements IChannelMana protected void internalDone(Object caller, IStatus status) { Throwable error = status.getException(); + String message = null; + if (error != null) { + message = error.getLocalizedMessage(); + if ((message == null || "".equals(message)) && error.getCause() != null) { //$NON-NLS-1$ + message = error.getCause().getLocalizedMessage(); + } + } + if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) { CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.ChannelManager_openChannel_valueAdd_launch, new Object[] { Integer.valueOf(i), valueAdd.getLabel(), (error == null ? "success" : "failed"), //$NON-NLS-1$ //$NON-NLS-2$ - (error != null ? error.getLocalizedMessage() : null), + (error != null ? message : null), id }), 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, ChannelManager.this); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.java index 037033dc1..0e4852e56 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.java @@ -96,6 +96,11 @@ public class Messages extends NLS { public static String ChannelManager_stream_missing_service_message; public static String AbstractExternalValueAdd_error_invalidLocation; + public static String AbstractExternalValueAdd_start_at; + public static String AbstractExternalValueAdd_died_at; + public static String AbstractExternalValueAdd_running_at; + public static String AbstractExternalValueAdd_start_waiting_at; + public static String AbstractExternalValueAdd_stop_waiting_at; public static String AbstractExternalValueAdd_output; public static String AbstractExternalValueAdd_error_cause; public static String AbstractExternalValueAdd_error_processDied; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.properties index 6c107f983..3178c140d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/nls/Messages.properties @@ -37,6 +37,11 @@ ChannelManager_stream_closed_message=Channel must be open but is closed. ChannelManager_stream_missing_service_message=Streams service not available. AbstractExternalValueAdd_error_invalidLocation={0} executable image does not exist or is not readable.\n\nLocation: {1} +AbstractExternalValueAdd_start_at=Starting value-add process at {0}. Target id = {1} +AbstractExternalValueAdd_died_at=Value-add process died at {0}. Exit code was {1}. Target id = {2} +AbstractExternalValueAdd_running_at=Value-add process running at {0}. Listen to the value-add output for the port to connect to. Target id = {1} +AbstractExternalValueAdd_start_waiting_at=Start waiting for port to connect to at {0}. Timeout = {1} ms. Counter = {2}. Target id = {3} +AbstractExternalValueAdd_stop_waiting_at=Stop waiting for port to connect to at {0}. Error = {1}. Target id = {2} AbstractExternalValueAdd_output=Output read from value-add: {0}. Target id = {1} AbstractExternalValueAdd_error_cause=\n\nPossible cause:\n{0} AbstractExternalValueAdd_error_processDied={0} died with exit code {1}. diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/va/AbstractExternalValueAdd.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/va/AbstractExternalValueAdd.java index a45efe46b..87569c2c7 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/va/AbstractExternalValueAdd.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/va/AbstractExternalValueAdd.java @@ -11,6 +11,7 @@ package org.eclipse.tcf.te.tcf.core.va; import java.io.FileNotFoundException; import java.io.IOException; +import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; @@ -26,6 +27,7 @@ import org.eclipse.tcf.protocol.JSON; import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.te.runtime.callback.Callback; import org.eclipse.tcf.te.runtime.interfaces.IDisposable; +import org.eclipse.tcf.te.runtime.interfaces.ISharedConstants; import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; import org.eclipse.tcf.te.runtime.processes.ProcessOutputReaderThread; import org.eclipse.tcf.te.runtime.utils.net.IPAddressUtil; @@ -217,6 +219,11 @@ public abstract class AbstractExternalValueAdd extends AbstractValueAdd { ValueAddEntry entry = new ValueAddEntry(); if (error == null) { + if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) { + CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.AbstractExternalValueAdd_start_at, ISharedConstants.TIME_FORMAT.format(new Date(System.currentTimeMillis())), id), + 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, this); + } + // Get the external process Process process = launcher.getProcess(); try { @@ -224,12 +231,22 @@ public abstract class AbstractExternalValueAdd extends AbstractValueAdd { int exitCode = process.exitValue(); // Died -> Construct the error error = onProcessDied(launcher, exitCode); + + if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) { + CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.AbstractExternalValueAdd_died_at, new Object[] { ISharedConstants.TIME_FORMAT.format(new Date(System.currentTimeMillis())), Integer.valueOf(exitCode), id }), + 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, this); + } } catch (IllegalThreadStateException e) { // Still running -> Associate the process with the entry entry.process = process; // Associate the reader threads with the entry entry.outputReader = launcher.getOutputReader(); entry.errorReader = launcher.getErrorReader(); + + if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) { + CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.AbstractExternalValueAdd_running_at, ISharedConstants.TIME_FORMAT.format(new Date(System.currentTimeMillis())), id), + 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, this); + } } } @@ -239,12 +256,23 @@ public abstract class AbstractExternalValueAdd extends AbstractValueAdd { // The agent is started with "-S" to write out the peer attributes in JSON format. long timeout = getWaitForValueAddOutputTimeout(); int counter = Long.valueOf(Math.max(timeout, 200) / 200).intValue(); + + if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) { + CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.AbstractExternalValueAdd_start_waiting_at, new Object[] { ISharedConstants.TIME_FORMAT.format(new Date(System.currentTimeMillis())), Long.valueOf(timeout), Integer.valueOf(counter), id }), + 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, this); + } + while (counter > 0 && output == null) { try { // Check if the process is still alive or died in the meanwhile int exitCode = entry.process.exitValue(); // Died -> Construct the error error = onProcessDied(launcher, exitCode); + + if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) { + CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.AbstractExternalValueAdd_died_at, new Object[] { ISharedConstants.TIME_FORMAT.format(new Date(System.currentTimeMillis())), Integer.valueOf(exitCode), id }), + 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, this); + } } catch (IllegalThreadStateException e) { /* ignored on purpose */ } if (error != null) break; @@ -267,6 +295,11 @@ public abstract class AbstractExternalValueAdd extends AbstractValueAdd { } } + if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) { + CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.AbstractExternalValueAdd_stop_waiting_at, new Object[] { ISharedConstants.TIME_FORMAT.format(new Date(System.currentTimeMillis())), error, id }), + 0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, this); + } + Map<String, String> attrs = null; if (error == null) { |