]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/LogManager.java
Get new subscription item unit value from previously stored defaults
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / LogManager.java
index 2f6edbe01bc2a83ca74f1151691285021eefabdf..a4e1eab879a1563a79bca5787ac457b8b416e71e 100644 (file)
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.diagram;\r
-\r
-import java.util.Properties;\r
-\r
-import org.apache.log4j.Hierarchy;\r
-import org.apache.log4j.Level;\r
-import org.apache.log4j.Logger;\r
-import org.apache.log4j.PropertyConfigurator;\r
-import org.apache.log4j.spi.LoggerFactory;\r
-import org.apache.log4j.spi.RootLogger;\r
-\r
-/**\r
- * This class encapsulates a Log4J Hierarchy and centralizes all Logger access.\r
- */\r
-public class LogManager {\r
-\r
-    private Hierarchy hierarchy;\r
-\r
-    /**\r
-     * Creates a new LogManager. Saves the log and state location.\r
-     * Creates a new Hierarchy and add a new EventListener to it.\r
-     * Configure the hierarchy with the properties passed. Add this object to\r
-     * the list of active log managers.\r
-     * \r
-     * @param properties log configuration properties\r
-     */\r
-    public LogManager(Properties properties) {\r
-        this.hierarchy = new Hierarchy(new RootLogger(Level.DEBUG));\r
-        new PropertyConfigurator().doConfigure(properties, this.hierarchy);\r
-    }\r
-\r
-    /**\r
-     * Checks if this PluginLogManager is disabled for this level.\r
-     * \r
-     * @param level level value\r
-     * @return boolean true if it is disabled\r
-     */\r
-    public boolean isDisabled(int level) {\r
-        return this.hierarchy.isDisabled(level);\r
-    }\r
-\r
-    /**\r
-     * Enable logging for logging requests with level l or higher. By default\r
-     * all levels are enabled.\r
-     * \r
-     * @param level level object\r
-     */\r
-    public void setThreshold(Level level) {\r
-        this.hierarchy.setThreshold(level);\r
-    }\r
-\r
-    /**\r
-     * The string version of setThreshold(Level level)\r
-     * \r
-     * @param level level string\r
-     */\r
-    public void setThreshold(String level) {\r
-        this.hierarchy.setThreshold(level);\r
-    }\r
-\r
-    /**\r
-     * Get the repository-wide threshold.\r
-     * \r
-     * @return Level\r
-     */\r
-    public Level getThreshold() {\r
-        return this.hierarchy.getThreshold();\r
-    }\r
-\r
-    /**\r
-     * Returns a new logger instance named as the first parameter using the\r
-     * default factory. If a logger of that name already exists, then it will be\r
-     * returned. Otherwise, a new logger will be instantiated and then linked\r
-     * with its existing ancestors as well as children.\r
-     * \r
-     * @param clazz the class to get the logger for\r
-     * @return Logger\r
-     */\r
-    public Logger getLogger(Class<?> clazz) {\r
-        return this.hierarchy.getLogger(clazz.getName());\r
-    }\r
-\r
-    /**\r
-     * Returns a new logger instance named as the first parameter using the\r
-     * default factory. If a logger of that name already exists, then it will be\r
-     * returned. Otherwise, a new logger will be instantiated and then linked\r
-     * with its existing ancestors as well as children.\r
-     * \r
-     * @param name logger name\r
-     * @return Logger\r
-     */\r
-    public Logger getLogger(String name) {\r
-        return this.hierarchy.getLogger(name);\r
-    }\r
-\r
-    /**\r
-     * The same as getLogger(String name) but using a factory instance instead\r
-     * of a default factory.\r
-     * \r
-     * @param name logger name\r
-     * @param factory factory instance\r
-     * @return Logger\r
-     */\r
-    public Logger getLogger(String name, LoggerFactory factory) {\r
-        return this.hierarchy.getLogger(name, factory);\r
-    }\r
-\r
-    /**\r
-     * Returns the root of this hierarchy.\r
-     * \r
-     * @return Logger\r
-     */\r
-    public Logger getRootLogger() {\r
-        return this.hierarchy.getRootLogger();\r
-    }\r
-\r
-    /**\r
-     * Checks if this logger exists.\r
-     * \r
-     * @return Logger\r
-     */\r
-    public Logger exists(String name) {\r
-        return this.hierarchy.exists(name);\r
-    }\r
-\r
-    /**\r
-     * Disposes the logger hierarchy\r
-     */\r
-    public void shutdown() {\r
-        this.hierarchy.shutdown();\r
-    }\r
-\r
-    /**\r
-     * Resets configuration values to its defaults.\r
-     */\r
-    public void resetConfiguration() {\r
-        this.hierarchy.resetConfiguration();\r
-    }\r
-\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * 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:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.diagram;
+
+import java.util.Properties;
+
+import org.apache.log4j.Hierarchy;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.spi.LoggerFactory;
+import org.apache.log4j.spi.RootLogger;
+
+/**
+ * This class encapsulates a Log4J Hierarchy and centralizes all Logger access.
+ */
+public class LogManager {
+
+    private Hierarchy hierarchy;
+
+    /**
+     * Creates a new LogManager. Saves the log and state location.
+     * Creates a new Hierarchy and add a new EventListener to it.
+     * Configure the hierarchy with the properties passed. Add this object to
+     * the list of active log managers.
+     * 
+     * @param properties log configuration properties
+     */
+    public LogManager(Properties properties) {
+        this.hierarchy = new Hierarchy(new RootLogger(Level.DEBUG));
+        new PropertyConfigurator().doConfigure(properties, this.hierarchy);
+    }
+
+    /**
+     * Checks if this PluginLogManager is disabled for this level.
+     * 
+     * @param level level value
+     * @return boolean true if it is disabled
+     */
+    public boolean isDisabled(int level) {
+        return this.hierarchy.isDisabled(level);
+    }
+
+    /**
+     * Enable logging for logging requests with level l or higher. By default
+     * all levels are enabled.
+     * 
+     * @param level level object
+     */
+    public void setThreshold(Level level) {
+        this.hierarchy.setThreshold(level);
+    }
+
+    /**
+     * The string version of setThreshold(Level level)
+     * 
+     * @param level level string
+     */
+    public void setThreshold(String level) {
+        this.hierarchy.setThreshold(level);
+    }
+
+    /**
+     * Get the repository-wide threshold.
+     * 
+     * @return Level
+     */
+    public Level getThreshold() {
+        return this.hierarchy.getThreshold();
+    }
+
+    /**
+     * Returns a new logger instance named as the first parameter using the
+     * default factory. If a logger of that name already exists, then it will be
+     * returned. Otherwise, a new logger will be instantiated and then linked
+     * with its existing ancestors as well as children.
+     * 
+     * @param clazz the class to get the logger for
+     * @return Logger
+     */
+    public Logger getLogger(Class<?> clazz) {
+        return this.hierarchy.getLogger(clazz.getName());
+    }
+
+    /**
+     * Returns a new logger instance named as the first parameter using the
+     * default factory. If a logger of that name already exists, then it will be
+     * returned. Otherwise, a new logger will be instantiated and then linked
+     * with its existing ancestors as well as children.
+     * 
+     * @param name logger name
+     * @return Logger
+     */
+    public Logger getLogger(String name) {
+        return this.hierarchy.getLogger(name);
+    }
+
+    /**
+     * The same as getLogger(String name) but using a factory instance instead
+     * of a default factory.
+     * 
+     * @param name logger name
+     * @param factory factory instance
+     * @return Logger
+     */
+    public Logger getLogger(String name, LoggerFactory factory) {
+        return this.hierarchy.getLogger(name, factory);
+    }
+
+    /**
+     * Returns the root of this hierarchy.
+     * 
+     * @return Logger
+     */
+    public Logger getRootLogger() {
+        return this.hierarchy.getRootLogger();
+    }
+
+    /**
+     * Checks if this logger exists.
+     * 
+     * @return Logger
+     */
+    public Logger exists(String name) {
+        return this.hierarchy.exists(name);
+    }
+
+    /**
+     * Disposes the logger hierarchy
+     */
+    public void shutdown() {
+        this.hierarchy.shutdown();
+    }
+
+    /**
+     * Resets configuration values to its defaults.
+     */
+    public void resetConfiguration() {
+        this.hierarchy.resetConfiguration();
+    }
+
 }
\ No newline at end of file