summaryrefslogtreecommitdiff
path: root/src/plugins/logger/src/com/motorola/studio/android
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/logger/src/com/motorola/studio/android')
-rw-r--r--src/plugins/logger/src/com/motorola/studio/android/logger/Level.java77
-rw-r--r--src/plugins/logger/src/com/motorola/studio/android/logger/Logger.java289
-rw-r--r--src/plugins/logger/src/com/motorola/studio/android/logger/internal/Activator.java64
-rw-r--r--src/plugins/logger/src/com/motorola/studio/android/logger/internal/EclipseEnvironmentManager.java328
-rw-r--r--src/plugins/logger/src/com/motorola/studio/android/logger/internal/EnvironmentManager.java28
-rw-r--r--src/plugins/logger/src/com/motorola/studio/android/logger/internal/VMEnvironmentManager.java60
6 files changed, 846 insertions, 0 deletions
diff --git a/src/plugins/logger/src/com/motorola/studio/android/logger/Level.java b/src/plugins/logger/src/com/motorola/studio/android/logger/Level.java
new file mode 100644
index 0000000..20efd56
--- /dev/null
+++ b/src/plugins/logger/src/com/motorola/studio/android/logger/Level.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.motorola.studio.android.logger;
+
+/**
+ * Level defines standard logging levels.</p> The standard levels are <b> DEBUG
+ * < INFO < WARN < ERROR < FATAL </b>.
+ * <p>
+ * <b>Note:</b><br>
+ * A log operation of level x in a logger with level y, is enabled if and only
+ * if x >= y.
+ * <p>
+ * <p>
+ * <b>Example:</b><br>
+ * If the level is set to <b>ERROR</b> only messages with level of <b>ERROR</b>
+ * and <b>FATAL</b> will be logged.
+ */
+public final class Level
+{
+
+ // Constants ---------------------------------------
+ /**
+ * Disables all logging levels from being logged. After setting Level to
+ * OFF, no messages will be recorded in log file.
+ */
+ public static final int OFF = Integer.MAX_VALUE;
+
+ /**
+ * The FATAL level is used for severe error events. In case of FATAL, the
+ * application could be aborted.
+ */
+ public static final int FATAL = org.apache.log4j.Level.FATAL_INT;
+
+ /**
+ * The ERROR level is used by errors events. Less severe than FATAL, used
+ * for situations of error that will not crash the application.
+ */
+ public static final int ERROR = org.apache.log4j.Level.ERROR_INT;
+
+ /**
+ * The WARN level is used for potentially harmful situations. Used for
+ * situations that can generate an error.
+ */
+ public static final int WARN = org.apache.log4j.Level.WARN_INT;
+
+ /**
+ * The INFO level is used for informational messages. Informational messages
+ * are used to notify the progress of the application or relevant messages
+ * to be analyzed, like the tracing of the application execution.
+ */
+ public static final int INFO = org.apache.log4j.Level.INFO_INT;
+
+ /**
+ * The DEBUG level is used for relevant informations on an application, like
+ * variable values.
+ */
+ public static final int DEBUG = org.apache.log4j.Level.DEBUG_INT;
+
+ /**
+ * Enables all logging levels. After setting Level to ALL, all the messages
+ * will be recorded in log file.
+ */
+ public static final int ALL = Integer.MIN_VALUE;
+}
diff --git a/src/plugins/logger/src/com/motorola/studio/android/logger/Logger.java b/src/plugins/logger/src/com/motorola/studio/android/logger/Logger.java
new file mode 100644
index 0000000..3b07641
--- /dev/null
+++ b/src/plugins/logger/src/com/motorola/studio/android/logger/Logger.java
@@ -0,0 +1,289 @@
+/*
+* Copyright (C) 2012 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package com.motorola.studio.android.logger;
+
+import java.util.HashMap;
+
+import org.apache.log4j.Level;
+
+import com.motorola.studio.android.logger.internal.EclipseEnvironmentManager;
+import com.motorola.studio.android.logger.internal.EnvironmentManager;
+
+/**
+ * Logger provides a logging facility to the <b>MOTODEV Studio</b> based
+ * applications such as Studios and RCP applications. </p> <b>Note:</b> The logs
+ * will be saved on the plug-in state area for this plug-in.
+ */
+public class Logger
+{
+
+ // Class Constants --------------------------------------------------------
+
+ /**
+ * This static block loads the log4j configuration file and resolves the
+ * path to save the logger log file.
+ */
+ static
+ {
+ /* Logging Environment Information */
+ EnvironmentManager envManager = new EclipseEnvironmentManager();
+ envManager.logEnvironment();
+ }
+
+ // Private Variables
+ // --------------------------------------------------------
+
+ /*
+ * This Map pools the Logger instances.
+ */
+ private static HashMap<String, Logger> pool;
+
+ /*
+ * Log4j logger instance being wrapped.
+ */
+ private final org.apache.log4j.Logger logger;
+
+ /**
+ * Builds a logger associated to the specified name.
+ *
+ * @param name The name of the logger.
+ */
+ private Logger(String name)
+ {
+ logger = org.apache.log4j.Logger.getLogger(name);
+ }
+
+ /**
+ * Gets a logger named according to the value of the name parameter. If the
+ * named logger already exists, then the existing instance will be returned.
+ * Otherwise, a new instance is created.
+ *
+ * @param name The name of the logger.
+ * @return the logger associated to the specified name.
+ */
+ public static synchronized Logger getLogger(String name)
+ {
+ Logger logger = null;
+ if (pool == null)
+ {
+ pool = new HashMap<String, Logger>();
+ }
+
+ if (pool.containsKey(name))
+ {
+ logger = pool.get(name);
+ }
+ else
+ {
+ logger = new Logger(name);
+ pool.put(name, logger);
+ }
+ return logger;
+ }
+
+ /**
+ * Logs the specified message with the specified level.
+ *
+ * @param level The log level.
+ * @param message The message to log.
+ */
+ public void log(int level, String message)
+ {
+ boolean key = true;
+ if ((level == com.motorola.studio.android.logger.Level.OFF)
+ || (level == com.motorola.studio.android.logger.Level.ALL))
+ {
+ key = false;
+ }
+
+ if (key)
+ {
+ logger.log(Level.toLevel(level), message);
+ }
+ }
+
+ /**
+ * Logs the specified message and an exception stack trace.
+ *
+ * @param level The log level.
+ * @param message The message to log.
+ * @param exception Exception whose stack will be logged.
+ */
+ public void log(int level, String message, Throwable exception)
+ {
+ boolean key = true;
+ if ((level == com.motorola.studio.android.logger.Level.OFF)
+ || (level == com.motorola.studio.android.logger.Level.ALL))
+ {
+ key = false;
+ }
+ if (key)
+ {
+ logger.log(Level.toLevel(level), message, exception);
+ }
+ }
+
+ /**
+ * Log a message object with the DEBUG level.
+ *
+ * @param message The message to log.
+ */
+ public void debug(String message)
+ {
+ debug(message, null);
+ }
+
+ /**
+ * Log a message object with the DEBUG level.
+ *
+ * @param message The message to log.
+ * @param exception Exception whose stack will be logged.
+ */
+ public void debug(String message, Throwable exception)
+ {
+ if (null == exception)
+ {
+ logger.debug(message);
+ }
+ else
+ {
+ logger.debug(message, exception);
+ }
+ }
+
+ /**
+ * Log a message object with the INFO level.
+ *
+ * @param message The message to log.
+ */
+ public void info(String message)
+ {
+ info(message, null);
+ }
+
+ /**
+ * Log a message object with the INFO level.
+ *
+ * @param message The message to log.
+ * @param exception Exception whose stack will be logged.
+ */
+ public void info(String message, Throwable exception)
+ {
+ if (null == exception)
+ {
+ logger.info(message);
+ }
+ else
+ {
+ logger.info(message, exception);
+ }
+ }
+
+ /**
+ * Log a message object with the WARN level.
+ *
+ * @param message The message to log.
+ */
+ public void warn(String message)
+ {
+ warn(message, null);
+ }
+
+ /**
+ * Log a message object with the WARN level.
+ *
+ * @param message The message to log.
+ * @param exception Exception whose stack will be logged.
+ */
+ public void warn(String message, Throwable exception)
+ {
+ if (null == exception)
+ {
+ logger.warn(message);
+ }
+ else
+ {
+ logger.warn(message, exception);
+ }
+ }
+
+ /**
+ * Log a message object with the ERROR level.
+ *
+ * @param message The message to log.
+ */
+ public void error(String message)
+ {
+ error(message, null);
+ }
+
+ /**
+ * Log a message object with the ERROR level.
+ *
+ * @param message The message to log.
+ * @param exception Exception whose stack will be logged.
+ */
+ public void error(String message, Throwable exception)
+ {
+ if (null == exception)
+ {
+ logger.error(message);
+ }
+ else
+ {
+ logger.error(message, exception);
+ }
+ }
+
+ /**
+ * Log a message object with the FATAL level.
+ *
+ * @param message The message to log.
+ */
+ public void fatal(String message)
+ {
+ fatal(message, null);
+ }
+
+ /**
+ * Log a message object with the FATAL level.
+ *
+ * @param message The message to log.
+ * @param exception Exception whose stack will be logged.
+ */
+ public void fatal(String message, Throwable exception)
+ {
+ if (null == exception)
+ {
+ logger.fatal(message);
+ }
+ else
+ {
+ logger.fatal(message, exception);
+ }
+ }
+
+ /**
+ * Sets the Logger level to the specified value.
+ *
+ * @param level One of the com.motorola.studio.platform.logger.Level
+ * constants.
+ */
+ public void setLevel(int level)
+ {
+ logger.setLevel(Level.toLevel(level));
+ }
+}
diff --git a/src/plugins/logger/src/com/motorola/studio/android/logger/internal/Activator.java b/src/plugins/logger/src/com/motorola/studio/android/logger/internal/Activator.java
new file mode 100644
index 0000000..6daa641
--- /dev/null
+++ b/src/plugins/logger/src/com/motorola/studio/android/logger/internal/Activator.java
@@ -0,0 +1,64 @@
+/*
+* Copyright (C) 2012 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package com.motorola.studio.android.logger.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin
+{
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.motorolamobility.studio.android.logger"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator()
+ {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception
+ {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+
+}
diff --git a/src/plugins/logger/src/com/motorola/studio/android/logger/internal/EclipseEnvironmentManager.java b/src/plugins/logger/src/com/motorola/studio/android/logger/internal/EclipseEnvironmentManager.java
new file mode 100644
index 0000000..c8f72d2
--- /dev/null
+++ b/src/plugins/logger/src/com/motorola/studio/android/logger/internal/EclipseEnvironmentManager.java
@@ -0,0 +1,328 @@
+/*
+* Copyright (C) 2012 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package com.motorola.studio.android.logger.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.log4j.PropertyConfigurator;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IBundleGroup;
+import org.eclipse.core.runtime.IBundleGroupProvider;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.Bundle;
+
+import com.motorola.studio.android.logger.Logger;
+
+/**
+ * EclipseEnvironmentManager logs the Eclipse environment information such as
+ * all plug-ins available on runtime. It logs the Virtual Machine information as
+ * well by calling the VMEnvironmentManager class method.
+ */
+public class EclipseEnvironmentManager implements EnvironmentManager
+{
+
+ /**
+ * The configuration element
+ */
+ private static final String CONFIGURATION = "configuration"; //$NON-NLS-1$
+
+ /**
+ * Log file name.
+ */
+ public static final String PROPERTY = "logger.properties"; //$NON-NLS-1$
+
+ /**
+ * Platform Logger appender.
+ */
+ public static final String DEFLOG_FILE = "log4j.appender.default.File"; //$NON-NLS-1$
+
+ /**
+ * Platform Environment Logger appender.
+ */
+ public static final String ENVLOG_FILE = "log4j.appender.envconf.File"; //$NON-NLS-1$
+
+ /**
+ * Logs the environment
+ */
+ public void logEnvironment()
+ {
+ IBundleGroup[] bundleGroup;
+ Bundle[] bundles;
+ Bundle bundle;
+
+ /* Map with all extensions configurations. */
+ Map<String, String> log4jPropertiesMap = new LinkedHashMap<String, String>();
+ Properties log4jProperties = new Properties();
+
+ try
+ {
+ /* Reads configuration extension point extensions */
+ this.getExtensionsConfiguration(log4jPropertiesMap);
+ this.getPlatformConfiguration(log4jPropertiesMap);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ /* Builds a properties with all configurations */
+ Set<String> keys = log4jPropertiesMap.keySet();
+ for (String key : keys)
+ {
+ log4jProperties.setProperty(key, log4jPropertiesMap.get(key));
+ }
+ PropertyConfigurator.configure(log4jProperties);
+
+ /* Logs the Environment */
+ new VMEnvironmentManager().logEnvironment();
+
+ Logger envLogger = Logger.getLogger("com.motorola.studio.environment"); //$NON-NLS-1$
+ IBundleGroupProvider[] registry = Platform.getBundleGroupProviders();
+ envLogger.info("--------------------------------------"); //$NON-NLS-1$
+ envLogger.info("## Eclipse Plug-ins Log Information ##"); //$NON-NLS-1$
+ envLogger.info("--------------------------------------"); //$NON-NLS-1$
+ for (int i = 0; i < registry.length; i++)
+ {
+ bundleGroup = registry[i].getBundleGroups();
+ for (int j = 0; j < bundleGroup.length; j++)
+ {
+ bundles = bundleGroup[j].getBundles();
+ for (int k = 0; k < bundles.length; k++)
+ {
+ bundle = bundles[k];
+ Dictionary<String, String> values = bundle.getHeaders();
+ envLogger.info(bundle.getSymbolicName() + " - " + //$NON-NLS-1$
+ values.get("Bundle-Version")); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ /**
+ * Getter of the workspace path
+ *
+ * @return The workspace path
+ */
+ private File getLogsFolder()
+ {
+ IPath workspacePath = Activator.getDefault().getStateLocation();
+ File file = null;
+ if (workspacePath != null)
+ {
+ file = workspacePath.toFile();
+ }
+ return file;
+ }
+
+ /**
+ * Loads the Platform configuration.
+ *
+ * @param log4jPropertiesMap Map to append properties keys and values.
+ * @throws IOException if any IO error occurs.
+ */
+ private void getPlatformConfiguration(Map<String, String> log4jPropertiesMap)
+ throws IOException
+ {
+ /* Reads the default configuration. */
+ Activator activator = Activator.getDefault();
+ if (activator != null)
+ {
+ URL bundleUrl = activator.getBundle().getEntry(PROPERTY);
+ if (bundleUrl != null)
+ {
+ Properties props = new Properties();
+ props.load(bundleUrl.openStream());
+
+ File logs = this.getLogsFolder();
+ if (!logs.exists())
+ {
+ throw new RuntimeException("State folder does not exist."); //$NON-NLS-1$
+ }
+
+ String logFileName = props.getProperty(DEFLOG_FILE);
+ String envFileName = props.getProperty(ENVLOG_FILE);
+ if ((logFileName != null) && (envFileName != null))
+ {
+ File logFile = new File(logs.getAbsolutePath() + File.separator + logFileName);
+ File envFile = new File(logs.getAbsolutePath() + File.separator + envFileName);
+ props.setProperty(DEFLOG_FILE, logFile.getAbsolutePath());
+ props.setProperty(ENVLOG_FILE, envFile.getAbsolutePath());
+
+ Enumeration<Object> keys = props.keys();
+ while (keys.hasMoreElements())
+ {
+ String key = (String) keys.nextElement();
+ String value = props.getProperty(key);
+ if (value != null)
+ {
+ log4jPropertiesMap.put(key, value);
+ }
+ }
+ }
+ else
+ {
+ throw new RuntimeException("Logger property file is corrupted."); //$NON-NLS-1$
+ }
+ }
+ else
+ {
+ throw new RuntimeException("Could not get logger.properties URL."); //$NON-NLS-1$
+ }
+ }
+ else
+ {
+ throw new RuntimeException(
+ "Could not get com.motorola.studio.platform.logger activator."); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Loads all configuration extension point extensions to read properties
+ * files.
+ *
+ * @param log4jPropertiesMap Map to append properties keys and values.
+ */
+ private void getExtensionsConfiguration(Map<String, String> log4jPropertiesMap)
+ {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extPoint = registry.getExtensionPoint(Activator.PLUGIN_ID, CONFIGURATION);
+ IExtension[] exts = extPoint.getExtensions();
+
+ for (int i = 0; i < exts.length; i++)
+ {
+ IExtension ext = exts[i];
+ if (ext != null)
+ {
+ IConfigurationElement[] configuration = ext.getConfigurationElements();
+ for (int j = 0; j < configuration.length; j++)
+ {
+ IConfigurationElement config = configuration[j];
+ if ((config != null) && config.getName().equals(CONFIGURATION))
+ {
+ String file = config.getAttribute("file"); //$NON-NLS-1$
+ if ((file != null) && (file.length() > 0))
+ {
+ Bundle plugin = Platform.getBundle(ext.getNamespaceIdentifier());
+ if (plugin != null)
+ {
+ URL url = plugin.getEntry(file);
+ if (url != null)
+ {
+ InputStream stream = null;
+ Properties props = null;
+ try
+ {
+ stream = FileLocator.toFileURL(url).openStream();
+ props = new Properties();
+ props.load(stream);
+ }
+ catch (IOException e)
+ {
+ /*
+ * In case the custom configuration file
+ * can not be read the default will be
+ * used.
+ */
+ Activator
+ .getDefault()
+ .getLog()
+ .log(new Status(
+ IStatus.WARNING,
+ ext.getNamespaceIdentifier(),
+ 0,
+ ext.getNamespaceIdentifier()
+ + " can not be loaded, using default configuration.", e)); //$NON-NLS-1$
+ }
+ finally
+ {
+ try
+ {
+ stream.close();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ if (props != null)
+ {
+ Enumeration<Object> keys = props.keys();
+ while (keys.hasMoreElements())
+ {
+ String key = (String) keys.nextElement();
+ String value = props.getProperty(key);
+ if (key.startsWith("log4j.appender.") && key.endsWith(".File")) { //$NON-NLS-1$ //$NON-NLS-2$
+ File logs = this.getLogsFolder();
+ if (logs != null)
+ {
+ value =
+ logs.getAbsolutePath() + File.separator
+ + value;
+ File customLogFile = new File(value);
+ if (customLogFile.exists())
+ {
+ customLogFile.delete();
+ }
+ }
+ }
+ if (value != null)
+ {
+ log4jPropertiesMap.put(key, value);
+ }
+ }
+ }
+
+ }
+ else
+ {
+ Activator
+ .getDefault()
+ .getLog()
+ .log(new Status(
+ IStatus.WARNING,
+ ext.getNamespaceIdentifier(),
+ 0,
+ "Could not load " + //$NON-NLS-1$
+ file
+ + " from " + ext.getNamespaceIdentifier() + //$NON-NLS-1$
+ " plugin.", //$NON-NLS-1$
+ null));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/plugins/logger/src/com/motorola/studio/android/logger/internal/EnvironmentManager.java b/src/plugins/logger/src/com/motorola/studio/android/logger/internal/EnvironmentManager.java
new file mode 100644
index 0000000..cff447e
--- /dev/null
+++ b/src/plugins/logger/src/com/motorola/studio/android/logger/internal/EnvironmentManager.java
@@ -0,0 +1,28 @@
+/*
+* Copyright (C) 2012 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package com.motorola.studio.android.logger.internal;
+
+/**
+ * This interface provides a way to log the machine environment.
+ */
+public interface EnvironmentManager
+{
+
+ /**
+ * Logs the environment.
+ */
+ public void logEnvironment();
+}
diff --git a/src/plugins/logger/src/com/motorola/studio/android/logger/internal/VMEnvironmentManager.java b/src/plugins/logger/src/com/motorola/studio/android/logger/internal/VMEnvironmentManager.java
new file mode 100644
index 0000000..41da3dc
--- /dev/null
+++ b/src/plugins/logger/src/com/motorola/studio/android/logger/internal/VMEnvironmentManager.java
@@ -0,0 +1,60 @@
+/*
+* Copyright (C) 2012 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package com.motorola.studio.android.logger.internal;
+
+import com.motorola.studio.android.logger.Logger;
+
+/**
+ * This class logs the Environment according to VM information.
+ */
+public class VMEnvironmentManager implements EnvironmentManager
+{
+
+ // Constants --------------------------------------------
+
+ private static final String[] property =
+ {
+ "os.name", //$NON-NLS-1$
+ "os.arch", //$NON-NLS-1$
+ "os.version", //$NON-NLS-1$
+ "java.version", //$NON-NLS-1$
+ "java.vendor", //$NON-NLS-1$
+ "java.vendor.url", //$NON-NLS-1$
+ "java.home", //$NON-NLS-1$
+ "java.vm.specification.name", //$NON-NLS-1$
+ "java.vm.specification.vendor", //$NON-NLS-1$
+ "java.vm.specification.version", //$NON-NLS-1$
+ "java.class.path", //$NON-NLS-1$
+ "java.library.path" //$NON-NLS-1$
+ };
+
+ /**
+ * Logs the environment based on the System VM properties.
+ */
+ public void logEnvironment()
+ {
+ Logger envLogger = Logger.getLogger("com.motorola.studio.environment"); //$NON-NLS-1$
+ /*Navigates looking for the neccessary information.*/
+ for (int i = 0; i < property.length; i++)
+ {
+ String value = System.getProperty(property[i]);
+ if (value != null)
+ {
+ envLogger.info(property[i] + " - " + value); //$NON-NLS-1$
+ }
+ }
+ }
+}