[100364] Tracing for WST-WS.
diff --git a/plugins/org.eclipse.wst.common.environment/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.common.environment/META-INF/MANIFEST.MF
index 9966579..2e5cec4 100644
--- a/plugins/org.eclipse.wst.common.environment/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.common.environment/META-INF/MANIFEST.MF
@@ -3,10 +3,12 @@
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.common.environment
Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.wst.common.internal.environment.plugin.EnvironmentPlugin
Bundle-Localization: plugin
+Export-Package: org.eclipse.wst.common.environment,
+ org.eclipse.wst.common.environment.uri
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.osgi.util
-Export-Package: org.eclipse.wst.common.environment,
- org.eclipse.wst.common.environment.uri
Bundle-Vendor: %providerName
+Eclipse-AutoStart: true
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseLog.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseLog.java
index ef48ab5..e1d75e6 100644
--- a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseLog.java
+++ b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/eclipse/EclipseLog.java
@@ -1,28 +1,34 @@
/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
+ * Copyright (c) 2004, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
- * IBM Corporation - initial API and implementation
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060221 100364 pmoogk@ca.ibm.com - Peter Moogk
*******************************************************************************/
package org.eclipse.wst.common.internal.environment.eclipse;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
import org.eclipse.wst.common.environment.ILog;
+import org.eclipse.wst.common.internal.environment.plugin.EnvironmentPlugin;
public class EclipseLog implements org.eclipse.wst.common.environment.ILog
{
-// private Logger logger;
- public EclipseLog() {
- /*
- logger = Logger.getLogger("org.eclipse.wst.command.env");
- // logger.setLogFileName("env.log");
- logger.setLevel(Level.INFO); // log all levels for now
- */
+ private org.eclipse.core.runtime.ILog logger;
+
+ public EclipseLog()
+ {
+ Plugin plugin = EnvironmentPlugin.getInstance();
+
+ logger = plugin.getLog();
}
/**
@@ -45,28 +51,46 @@
* @see org.eclipse.wst.common.environment.ILog#log(int, int, java.lang.Object, java.lang.String, java.lang.Object)
*/
public void log(int severity, int messageNum, Object caller,
- String method, Object object) {
+ String method, Object object)
+ {
if (isEnabled()) {
switch (severity) {
case ILog.ERROR :
+ {
if (isEnabled("error"))
- System.out.println(getMessageNumString(messageNum) + "E "
+ {
+ String message = getMessageNumString(messageNum) + "E "
+ caller + "::" + method + ": object="
- + object);
+ + object;
+ log( severity, message, null );
+ }
break;
+ }
+
case ILog.WARNING :
+ {
if (isEnabled("warning"))
- System.out.println(getMessageNumString(messageNum)
+ {
+ String message = getMessageNumString(messageNum)
+ "W " + caller + "::" + method
- + ": object=" + object);
+ + ": object=" + object;
+ log( severity, message, null );
+ }
break;
+ }
+
case ILog.INFO :
+ {
if (isEnabled("info"))
- System.out.println(getMessageNumString(messageNum) + "I "
+ {
+ String message = getMessageNumString(messageNum) + "I "
+ caller + "::" + method + ": object="
- + object);
+ + object;
+ log( severity, message, null );
+ }
break;
+ }
}
}
@@ -92,21 +116,27 @@
* @see org.eclipse.wst.common.environment.ILog#log(int, java.lang.String, int, java.lang.Object, java.lang.String, java.lang.Object)
*/
public void log(int severity, String option, int messageNum,
- Object caller, String method, Object object) {
+ Object caller, String method, Object object)
+ {
if (isEnabled(option))
- System.out.println(getMessageNumString(messageNum) + "I " + caller
- + "::" + method + ": object=" + object);
+ {
+ String message = getMessageNumString(messageNum) + "I " + caller
+ + "::" + method + ": object=" + object;
+ log(severity, message, null );
+ }
}
/**
* @see org.eclipse.wst.common.environment.ILog#log(int, java.lang.String, int, java.lang.Object, java.lang.String, java.lang.Throwable)
*/
public void log(int severity, String option, int messageNum,
- Object caller, String method, Throwable throwable) {
- if (isEnabled(option)) {
- System.out.println(getMessageNumString(messageNum) + "I " + caller
- + "::" + method);
- throwable.printStackTrace();
+ Object caller, String method, Throwable throwable)
+ {
+ if (isEnabled(option))
+ {
+ String message = getMessageNumString(messageNum) + "I " + caller
+ + "::" + method;
+ log( severity, message, throwable );
}
}
@@ -114,8 +144,9 @@
* @see org.eclipse.wst.common.environment.ILog#log(int, java.lang.String, int, java.lang.Object, java.lang.String, org.eclipse.core.runtime.IStatus)
*/
public void log(int severity, String option, int messageNum,
- Object caller, String method, IStatus status) {
- log(severity, option, messageNum, caller, method, (Object)status);
+ Object caller, String method, IStatus status)
+ {
+ logger.log( status );
}
private String getMessageNumString(int messageNum) {
@@ -125,4 +156,10 @@
messageNumString += (new Integer(messageNum)).toString();
return messageNumString;
}
+
+ private void log( int severity, String message, Throwable exc )
+ {
+ Status status = new Status( severity, "id", 0, message, exc );
+ logger.log( status );
+ }
}
diff --git a/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/plugin/EnvironmentPlugin.java b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/plugin/EnvironmentPlugin.java
new file mode 100644
index 0000000..4330459
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.environment/src/org/eclipse/wst/common/internal/environment/plugin/EnvironmentPlugin.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * yyyymmdd bug Email and other contact information
+ * -------- -------- -----------------------------------------------------------
+ * 20060221 100364 pmoogk@ca.ibm.com - Peter Moogk
+ *******************************************************************************/
+package org.eclipse.wst.common.internal.environment.plugin;
+
+
+import org.eclipse.core.runtime.Plugin;
+
+/**
+* This is the plugin class for the org.eclipse.wst.common.internal.environment.plugin.EnvironmentPlugin.
+*/
+public class EnvironmentPlugin extends Plugin
+{
+ /**
+ * The instance of this plugin.
+ */
+ private static EnvironmentPlugin instance;
+
+ /**
+ * Constructor for use by the Eclipse platform only.
+ */
+ public EnvironmentPlugin()
+ {
+ super();
+ instance = this;
+ }
+
+ /**
+ * Returns the instance of this plugin.
+ */
+ static public EnvironmentPlugin getInstance ()
+ {
+ return instance;
+ }
+}