Changing existing log4j logging to use slf4j 92/92/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 23 Sep 2016 21:30:33 +0000 (00:30 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 23 Sep 2016 21:30:33 +0000 (00:30 +0300)
Removed org.simantics.utils.logging.{Logger,LogManager}. Anybody using
those should just switch to using slf4j. Removed their use from
org.simantics.spreadsheet.graph.

Also changed org.simantics.utils.FileUtils to use slf4j instead of
log4j.

Also added .keep to org.simantics.logback.configuration/src folder to
help it compile properly.

refs #6705

Change-Id: Ib6d78ee964e0a05aedb332167456aee4eea2a4d7
Signed-off-by: Tuukka Lehtonen <tuukka.lehtonen@semantum.fi>
14 files changed:
bundles/org.simantics.logback.configuration/META-INF/MANIFEST.MF
bundles/org.simantics.logback.configuration/src/.keep [new file with mode: 0644]
bundles/org.simantics.spreadsheet.common/META-INF/MANIFEST.MF
bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/logging/Logger.java [deleted file]
bundles/org.simantics.spreadsheet.graph/META-INF/MANIFEST.MF
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/CellValue.java
bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphUI.java
bundles/org.simantics.structural.ontology/graph.tg
bundles/org.simantics.utils/META-INF/MANIFEST.MF
bundles/org.simantics.utils/src/org/simantics/utils/FileUtils.java
bundles/org.simantics.utils/src/org/simantics/utils/logging/LogManager.java [deleted file]
bundles/org.simantics.utils/src/org/simantics/utils/logging/Logger.java [deleted file]
bundles/org.simantics.workbench/META-INF/MANIFEST.MF
bundles/org.simantics/META-INF/MANIFEST.MF

index 504d772e2c66fcf2b8d20824ef6bf5596122e7c6..ae85b8ace41a5125f8ac0ac3157749c523702c67 100644 (file)
@@ -1,7 +1,9 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
-Bundle-Name: Configuration
+Bundle-Name: Simantics Logback Configuration
 Bundle-SymbolicName: org.simantics.logback.configuration
 Bundle-Version: 1.0.0.qualifier
 Fragment-Host: ch.qos.logback.classic;bundle-version="1.1.7"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: ch.qos.logback.core;bundle-version="1.1.7"
+Bundle-Vendor: Semantum Oy
diff --git a/bundles/org.simantics.logback.configuration/src/.keep b/bundles/org.simantics.logback.configuration/src/.keep
new file mode 100644 (file)
index 0000000..e69de29
index f76f025c3d83d9db7e092a72a91cb5609ae50588..ff08ff65d7d8bd96db603ac3372e0dbf352c4adb 100644 (file)
@@ -23,7 +23,6 @@ Export-Package: org.simantics.spreadsheet.common,
  org.simantics.spreadsheet.common.expression.lexer,
  org.simantics.spreadsheet.common.expression.node,
  org.simantics.spreadsheet.common.expression.parser,
- org.simantics.spreadsheet.common.logging,
  org.simantics.spreadsheet.common.matrix,
  org.simantics.spreadsheet.util
 Bundle-Vendor: VTT Technical Research Centre of Finland
diff --git a/bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/logging/Logger.java b/bundles/org.simantics.spreadsheet.common/src/org/simantics/spreadsheet/common/logging/Logger.java
deleted file mode 100644 (file)
index 87cbaa1..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************\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.spreadsheet.common.logging;\r
-\r
-import org.simantics.spreadsheet.common.Activator;\r
-import org.simantics.utils.logging.LogManager;\r
-\r
-public class Logger extends org.simantics.utils.logging.Logger {\r
-       \r
-    private static final Logger INSTANCE = new Logger();\r
-    \r
-    Logger() {\r
-       super(new LogManager(\r
-                       defaultProperties("log4j.appender.default.File", "spreadsheet.log",\r
-                                       "log4j.appender.default.append", "true",\r
-                                       "log4j.appender.default.layout", "org.apache.log4j.PatternLayout",\r
-                                       "log4j.appender.default.layout.ConversionPattern", "%d{ISO8601} %-6r [%15.15t] %-5p %30.30c - %m%n",\r
-                                       "log4j.appender.default.File", Activator.LOG_FILE_NAME\r
-                                       )).getLogger(LogManager.class));\r
-    }\r
-    \r
-    public static void defaultLogError(String message, Throwable exception) {\r
-       INSTANCE.logError(message, exception);\r
-    }\r
-    \r
-    public static void defaultLogError(Throwable exception) {\r
-       INSTANCE.logError("Unexpected exception", exception);\r
-    }\r
-\r
-    public static void defaultLogWarning(String message, Throwable exception) {\r
-       INSTANCE.logWarning(message, exception);\r
-    }\r
-    \r
-}\r
index a5eef2fb2265eaec3cb1921bface8a1e4a103578..a61255e1ccd2a6898a6475cedef87ce6ae321802 100644 (file)
@@ -30,7 +30,8 @@ Require-Bundle: org.simantics.layer0.utils,
  org.simantics.modeling;bundle-version="1.1.1",
  org.eclipse.e4.core.contexts,
  org.eclipse.e4.ui.di,
- org.simantics.browsing.ui.swt
+ org.simantics.browsing.ui.swt,
+ org.slf4j.api;bundle-version="1.7.20"
 Export-Package: org.apache.commons.math3.stat.regression,
  org.simantics.spreadsheet.graph,
  org.simantics.spreadsheet.graph.adapter,
index 1236f8a3d1ecdaa86a1bdd42d218e75c07618622..990b23f084146f89828c6a9bd7185534fbffa769 100644 (file)
@@ -8,10 +8,13 @@ import org.simantics.db.ReadGraph;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.request.VariableRead;\r
 import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.spreadsheet.common.logging.Logger;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 public class CellValue extends VariableRead<Object> {\r
 \r
+       private static final Logger LOGGER = LoggerFactory.getLogger(CellValue.class);\r
+\r
        public CellValue(Variable variable) {\r
                super(variable);\r
        }\r
@@ -38,8 +41,9 @@ public class CellValue extends VariableRead<Object> {
                                        Binding binding = Bindings.getBinding( value2.getClass() );\r
                                return new Variant(binding, value2);\r
                                } catch (BindingConstructionException e) {\r
-                                       Logger.defaultLogError(e);\r
-                               return Variant.ofInstance("Unsupported content " + value2 + " from " + var.getURI(graph));\r
+                                       String msg = "Unsupported content " + value2 + " from " + var.getURI(graph);\r
+                                       LOGGER.error(msg, e);\r
+                               return Variant.ofInstance(msg);\r
                                }\r
                                }\r
                        }\r
@@ -48,8 +52,9 @@ public class CellValue extends VariableRead<Object> {
                                        Binding binding = Bindings.getBinding( value.getClass() );\r
                                return new Variant(binding, value);\r
                                } catch (BindingConstructionException e) {\r
-                                       Logger.defaultLogError(e);\r
-                                       return Variant.ofInstance("Unsupported content " + value + " at " + variable.getURI(graph));\r
+                                       String msg = "Unsupported content " + value + " at " + variable.getURI(graph);\r
+                                       LOGGER.error(msg, e);\r
+                                       return Variant.ofInstance(msg);\r
                                }\r
                        }\r
                }\r
index 9a3e8732679d284b4a30abfdbcfc274da9a708e7..b2fc404f23f200b1ff3477ce24e45c8bd22652e0 100644 (file)
@@ -61,7 +61,6 @@ import org.simantics.spreadsheet.CellEditor;
 import org.simantics.spreadsheet.ClientModel;\r
 import org.simantics.spreadsheet.ClientModel.OperationMode;\r
 import org.simantics.spreadsheet.SheetCommands;\r
-import org.simantics.spreadsheet.common.logging.Logger;\r
 import org.simantics.spreadsheet.event.model.RemoveCellHandler;\r
 import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
 import org.simantics.ui.selection.WorkbenchSelectionUtils;\r
@@ -69,6 +68,8 @@ import org.simantics.utils.datastructures.Pair;
 import org.simantics.utils.strings.AlphanumComparator;\r
 import org.simantics.utils.threads.logger.ITask;\r
 import org.simantics.utils.threads.logger.ThreadLogger;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 import gnu.trove.map.hash.THashMap;\r
 import gnu.trove.map.hash.TObjectIntHashMap;\r
@@ -102,6 +103,8 @@ class FilteredVariableProperties extends UnaryRead<Variable, Collection<Pair<Str
 \r
 public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport, SyncListenerSupport {\r
 \r
+       private static final Logger LOGGER = LoggerFactory.getLogger(GraphUI.class);\r
+\r
        final public static boolean DEBUG = false;\r
        \r
     final private RequestProcessor processor;\r
@@ -214,10 +217,10 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
        \r
        support.addListener(listener);\r
 \r
-        this.cellEditor = processor.sync(new VariableRead<CellEditor>(variable) {\r
+        this.cellEditor = processor.sync(new VariableRead<CellEditor<Write>>(variable) {\r
 \r
                        @Override\r
-                       public CellEditor perform(ReadGraph graph) throws DatabaseException {\r
+                       public CellEditor<Write> perform(ReadGraph graph) throws DatabaseException {\r
                                SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);\r
                                return variable.getPropertyValue(graph, SHEET.cellEditor);\r
                        }\r
@@ -338,6 +341,8 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
     \r
     private static class PropertyListener extends SingleSetSyncListenerDelegate<Pair<String,Variable>> {\r
 \r
+        private static final Logger LOGGER = LoggerFactory.getLogger(PropertyListener.class);\r
+\r
         private ClientModel client;\r
         private String childName;\r
         private boolean listenerDisposed;\r
@@ -370,7 +375,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                 @Override\r
                 public void exception(ReadGraph graph, Throwable throwable) throws DatabaseException {\r
                     \r
-                    Logger.defaultLogError(throwable);\r
+                    LOGGER.error("PropertyListener.exception", throwable);\r
                     \r
                     String propertyName = property.first;\r
                     if("content".equals(propertyName)) {\r
@@ -492,7 +497,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                return (T)new CellEditor<Write>() {\r
 \r
                                @Override\r
-                               public <T> void edit(Transaction<Write> transaction, String location, String property, T value, Binding binding, Consumer<?> callback) {\r
+                               public <E> void edit(Transaction<Write> transaction, String location, String property, E value, Binding binding, Consumer<?> callback) {\r
                                        \r
                                    if (ClientModel.ITERATION_ENABLED.equals(location)) {\r
                                        Simantics.getSession().asyncRequest(new ReadRequest() {\r
@@ -539,7 +544,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                                     load(newContext, client);\r
                                     return;\r
                                 } catch (DatabaseException e) {\r
-                                    Logger.defaultLogError(e);\r
+                                    LOGGER.error("edit failed for model key '" + ClientModel.CONTEXT_CURRENT + "'", e);\r
                                 }\r
                             }\r
                                        }\r
@@ -564,7 +569,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                                                                        load(newInput, client);\r
                                                                        return;\r
                                                                } catch (DatabaseException e) {\r
-                                                                       Logger.defaultLogError(e);\r
+                                                                       LOGGER.error("edit failed for model key '" + ClientModel.SHEETS_CURRENT + "'", e);\r
                                                                }\r
                                                        }\r
                                                }\r
@@ -610,7 +615,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
 //                                    fullSynchronize();\r
                                     return;\r
                                 } catch (DatabaseException e) {\r
-                                    Logger.defaultLogError(e);\r
+                                    LOGGER.error("edit failed for model key '" + ClientModel.STATES_CURRENT + "'", e);\r
                                 }\r
                             }\r
                         }\r
@@ -664,7 +669,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                                                                }\r
                                                                \r
                                                        } catch (DatabaseException e) {\r
-                                                               Logger.defaultLogError(e);\r
+                                                               LOGGER.error("edit failed for model key '" + ClientModel.SOURCES_CURRENT + "'", e);\r
                                                        }\r
                                                }\r
                                                return;\r
@@ -796,12 +801,12 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
 \r
     @Override\r
     public void exception(AsyncReadGraph graph, Throwable t) {\r
-       Logger.defaultLogError("Failed to read properties.", t);\r
+        LOGGER.error("Failed to read properties.", t);\r
     }\r
 \r
     @Override\r
     public void exception(ReadGraph graph, Throwable t) {\r
-       Logger.defaultLogError("Failed to read properties.", t);\r
+        LOGGER.error("Failed to read properties.", t);\r
     }\r
 \r
     public void dispose() {\r
index fbe043eabb42745f08acf3d0de55a72a1e04defd..5bfaa39d4da84879f7a224c6845ca07fe50c3c08 100644 (file)
Binary files a/bundles/org.simantics.structural.ontology/graph.tg and b/bundles/org.simantics.structural.ontology/graph.tg differ
index bb0a1bba03cdaff75e89d09fe0bae0563ca6879e..2e986992802600481cac512587cea90f348dce06 100644 (file)
@@ -14,6 +14,6 @@ Export-Package: org.simantics.utils,
  org.simantics.utils.xml
 Bundle-ClassPath: .
 Require-Bundle: org.junit;bundle-version="4.12.0";resolution:=optional,
- org.apache.log4j;bundle-version="1.2.15",
- org.simantics.databoard;bundle-version="0.6.2"
+ org.simantics.databoard;bundle-version="0.6.2",
+ org.slf4j.api;bundle-version="1.7.20"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
index aae9666ab4156d51c7afc4db3cee0bf10250f466..51449d57bf4814a03e788b66c20c9e7f66996a25 100644 (file)
@@ -47,7 +47,6 @@ import java.util.zip.ZipException;
 import java.util.zip.ZipInputStream;\r
 import java.util.zip.ZipOutputStream;\r
 \r
-import org.apache.log4j.Logger;\r
 import org.simantics.databoard.Bindings;\r
 import org.simantics.databoard.adapter.AdaptException;\r
 import org.simantics.databoard.adapter.Adapter;\r
@@ -56,6 +55,8 @@ import org.simantics.databoard.binding.Binding;
 import org.simantics.databoard.type.Datatype;\r
 import org.simantics.utils.bytes.LEInt;\r
 import org.simantics.utils.strings.FileNameUtils;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 /**\r
  * Utilities for common file operations.\r
@@ -68,6 +69,8 @@ import org.simantics.utils.strings.FileNameUtils;
  */\r
 public class FileUtils {\r
 \r
+       private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);\r
+\r
        /**\r
         * Create escaped filename\r
         * \r
@@ -536,8 +539,8 @@ public class FileUtils {
      *          <code>false</code> if some or all failed to be deleted\r
      */\r
     public static boolean deleteDir(File dir) {\r
-        Logger myLogger = Logger.getLogger(FileUtils.class);\r
-        myLogger.debug("Deleting directory "+dir);\r
+        if (LOGGER.isDebugEnabled())\r
+            LOGGER.debug("Deleting directory "+dir);\r
         boolean result = true;\r
 \r
         if (!dir.isDirectory()) return false;\r
@@ -555,8 +558,8 @@ public class FileUtils {
     }\r
     \r
     public static String deleteDirs(File dir) {        \r
-        Logger myLogger = Logger.getLogger(FileUtils.class);\r
-        myLogger.debug("Deleting directory "+dir);\r
+        if (LOGGER.isDebugEnabled())\r
+            LOGGER.debug("Deleting directory "+dir);\r
         boolean result = true;\r
 \r
         if (!dir.isDirectory()) \r
@@ -795,10 +798,8 @@ public class FileUtils {
     }\r
     \r
     public static void compressZip(String sourcePath, String zipDir) throws IOException {\r
-       Logger myLogger = Logger.getLogger(FileUtils.class);\r
-       myLogger.debug("Compressing file " + sourcePath + " to zip " + zipDir + ".");\r
-\r
-       System.out.println("Compressing file " + sourcePath + " to zip " + zipDir + ".");\r
+        if (LOGGER.isDebugEnabled())\r
+            LOGGER.debug("Compressing file " + sourcePath + " to zip " + zipDir + ".");\r
 \r
        File filesource = new File(sourcePath);\r
        URI base = filesource.toURI();\r
@@ -821,8 +822,7 @@ public class FileUtils {
                        }\r
                }\r
        } finally {\r
-               myLogger.debug("Filecompression done.");\r
-               System.out.println("Filecompression done.");\r
+               LOGGER.debug("Filecompression done.");\r
        }\r
     }\r
 \r
@@ -840,8 +840,8 @@ public class FileUtils {
      * @throws IOException\r
      */\r
     public static void extractZip(File zipFile, File dst) throws IOException {\r
-        Logger myLogger = Logger.getLogger(FileUtils.class);\r
-        myLogger.debug("Extracting zip "+zipFile);\r
+        if (LOGGER.isDebugEnabled())\r
+               LOGGER.debug("Extracting zip "+zipFile);\r
         try (FileInputStream fis = new FileInputStream(zipFile)) {\r
             extractZip(fis, dst);\r
         }\r
@@ -855,7 +855,6 @@ public class FileUtils {
      * @throws IOException\r
      */\r
     public static void extractZip(InputStream zipInput, File dst) throws IOException {\r
-        Logger myLogger = Logger.getLogger(FileUtils.class);\r
         byte[] buf = new byte[8192];\r
         ZipInputStream zis = new ZipInputStream(zipInput);\r
         ZipEntry entry;\r
@@ -864,7 +863,8 @@ public class FileUtils {
         while (entry != null) {\r
             // for each entry to be extracted\r
             String name = entry.getName();\r
-            myLogger.debug("Extracting "+name);\r
+            if (LOGGER.isDebugEnabled())\r
+                LOGGER.debug("Extracting "+name);\r
             File file = new File(dst, name);\r
 \r
             if (entry.isDirectory())\r
diff --git a/bundles/org.simantics.utils/src/org/simantics/utils/logging/LogManager.java b/bundles/org.simantics.utils/src/org/simantics/utils/logging/LogManager.java
deleted file mode 100644 (file)
index 1ee88a3..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************\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.utils.logging;\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
-}
\ No newline at end of file
diff --git a/bundles/org.simantics.utils/src/org/simantics/utils/logging/Logger.java b/bundles/org.simantics.utils/src/org/simantics/utils/logging/Logger.java
deleted file mode 100644 (file)
index 472f66c..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************\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.utils.logging;\r
-\r
-import java.util.Properties;\r
-\r
-abstract public class Logger {\r
-\r
-       public static final boolean ECHO = false;\r
-    \r
-    protected static final Properties defaultProperties(String ... keyValuePairs) {\r
-\r
-       assert(keyValuePairs.length % 2 == 0);\r
-       \r
-        Properties defaultProperties = new Properties();\r
-        defaultProperties.put("log4j.rootCategory", "ERROR, default");\r
-        defaultProperties.put("log4j.appender.default", "org.apache.log4j.FileAppender");\r
-        defaultProperties.put("log4j.appender.default.append", "false");\r
-        defaultProperties.put("log4j.appender.default.layout", "org.apache.log4j.PatternLayout");\r
-        defaultProperties.put("log4j.appender.default.layout.ConversionPattern", "%-6r [%15.15t] %-5p %30.30c - %m%n");\r
-        \r
-        for(int i=0;i<keyValuePairs.length;) {\r
-               String key = keyValuePairs[i++];\r
-               String value = keyValuePairs[i++];\r
-               defaultProperties.put(key, value);\r
-        }\r
-        \r
-        return defaultProperties; \r
-       \r
-    }\r
-    \r
-    final protected org.apache.log4j.Logger logger;\r
-    \r
-    protected Logger(org.apache.log4j.Logger logger) {\r
-       this.logger = logger;\r
-    }\r
-\r
-    final protected org.apache.log4j.Logger getLogger() {\r
-       return logger;\r
-    }\r
-    \r
-    /**\r
-     * Log a trace event.\r
-     * \r
-     * @param message message of the trace\r
-     * @param exception the exception, or <code>null</code>\r
-     */\r
-    public void logTrace(String message, Throwable exception) {\r
-        // Errors are much more useful with a stack trace!\r
-        if (exception == null) {\r
-            exception = new RuntimeException();\r
-        }\r
-        getLogger().trace(message, exception);\r
-    }\r
-\r
-    /**\r
-     * Log an info event.\r
-     * \r
-     * @param message message of the info\r
-     * @param exception the exception, or <code>null</code>\r
-     */\r
-    public void logInfo(String message, Throwable exception) {\r
-        // Errors are much more useful with a stack trace!\r
-        if (exception == null) {\r
-            exception = new RuntimeException();\r
-        }\r
-        getLogger().info(message, exception);\r
-    }\r
-\r
-    /**\r
-     * Log an error event.\r
-     * \r
-     * @param message message of the error\r
-     * @param exception the exception, or <code>null</code>\r
-     */\r
-    public void logError(String message, Throwable exception) {\r
-       \r
-        // Errors are much more useful with a stack trace!\r
-        if (exception == null) {\r
-            exception = new RuntimeException();\r
-        }\r
-        getLogger().error(message, exception);\r
-    }\r
-    \r
-    /**\r
-     * Log an error event.\r
-     * \r
-     * @param message message of the error\r
-     * @param exception the exception, or <code>null</code>\r
-     */\r
-    public void logWarning(String message, Throwable exception) {\r
-        // Errors are much more useful with a stack trace!\r
-        if (exception == null) {\r
-            exception = new RuntimeException();\r
-        }\r
-        getLogger().error(message, exception);\r
-    }\r
-    \r
-}\r
index 887f4937787def2c787a766b73656269d20dc89d..363faa7c94ce69144c61b7f79c0085e1408a0298 100644 (file)
@@ -45,9 +45,7 @@ Require-Bundle: com.ibm.icu,
  org.eclipse.e4.ui.di;bundle-version="1.1.0",
  org.eclipse.e4.core.contexts,
  org.eclipse.e4.ui.services,
- org.slf4j.api;bundle-version="1.7.20",
- ch.qos.logback.classic;bundle-version="1.1.7",
- ch.qos.logback.core;bundle-version="1.1.7"
+ org.slf4j.api;bundle-version="1.7.20"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Bundle-ClassPath: .
index d5f1ee27a3d847dee1c860fe1c739ddb96175858..90161d598ece6068fd690d1e0700be38036a9025 100644 (file)
@@ -20,9 +20,7 @@ Require-Bundle: org.eclipse.core.runtime;visibility:=reexport,
  org.simantics.scl.compiler;bundle-version="0.4.0",
  org.simantics.platform.ui.ontology;bundle-version="1.0.0",
  org.simantics.db.procore;bundle-version="1.1.0",
- org.slf4j.api,
- ch.qos.logback.classic,
- ch.qos.logback.core
+ org.slf4j.api
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Export-Package: org.simantics,