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
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
+++ /dev/null
-/*******************************************************************************\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
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,
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
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
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
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
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
\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
\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
\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
@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
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
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
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
// 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
}\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
\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
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
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
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
*/\r
public class FileUtils {\r
\r
+ private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);\r
+\r
/**\r
* Create escaped filename\r
* \r
* <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
}\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
}\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
}\r
}\r
} finally {\r
- myLogger.debug("Filecompression done.");\r
- System.out.println("Filecompression done.");\r
+ LOGGER.debug("Filecompression done.");\r
}\r
}\r
\r
* @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
* @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
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
+++ /dev/null
-/*******************************************************************************\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
+++ /dev/null
-/*******************************************************************************\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
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: .
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,