From 7e66fdd1670687a56d8ef980d14d83bfc5f16583 Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Fri, 5 Oct 2018 09:34:59 +0300 Subject: [PATCH] Goodbye db-client.log gitlab #142 Change-Id: I9d4c076e608bf427933083dc277c5333dead9c93 --- .../wrapper/SyncToAsyncListener.java | 6 +- .../org/simantics/db/common/utils/Logger.java | 173 +----------------- .../db/procore/ui/internal/Util.java | 2 +- .../procore/internal/BuiltinSupportImpl.java | 2 - .../procore/internal/ClusterTable.java | 34 ++-- .../procore/internal/GraphSessionSocket.java | 2 - .../db/procore/cluster/ResourceTable.java | 10 +- .../procore/cluster/ResourceTableSmall.java | 10 +- .../META-INF/MANIFEST.MF | 3 +- .../db/server/internal/ConnectionManager.java | 2 +- .../db/server/internal/DatabaseI.java | 6 +- .../db/server/internal/ProCoreServer.java | 3 +- .../simantics/db/server/internal/Util.java | 4 +- 13 files changed, 58 insertions(+), 199 deletions(-) diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/wrapper/SyncToAsyncListener.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/wrapper/SyncToAsyncListener.java index cd6866d6f..640eb8a22 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/wrapper/SyncToAsyncListener.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/procedure/wrapper/SyncToAsyncListener.java @@ -14,14 +14,16 @@ package org.simantics.db.common.procedure.wrapper; import org.simantics.db.AsyncReadGraph; import org.simantics.db.ReadGraph; import org.simantics.db.common.request.ReadRequest; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.procedure.AsyncListener; import org.simantics.db.procedure.Procedure; import org.simantics.db.procedure.SyncListener; +import org.slf4j.LoggerFactory; final public class SyncToAsyncListener implements AsyncListener { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(SyncToAsyncListener.class); + final private SyncListener procedure; public SyncToAsyncListener(SyncListener procedure) { @@ -48,7 +50,7 @@ final public class SyncToAsyncListener implements AsyncListener { @Override public void exception(Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("{} failed", SyncToAsyncListener.this.toString(), t); } @Override diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/Logger.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/Logger.java index c2411ae1d..01f15e0b5 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/Logger.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/utils/Logger.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * Copyright (c) 2007, 2010, 2018 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 @@ -8,181 +8,28 @@ * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation + * Semantum Oy - Deprecating and replace with SLF4J Logger *******************************************************************************/ package org.simantics.db.common.utils; -import java.util.Properties; - -import org.apache.log4j.Level; -import org.simantics.databoard.Bindings; -import org.simantics.db.DevelopmentKeys; -import org.simantics.db.common.internal.config.InternalClientConfig; -import org.simantics.utils.Development; +import org.slf4j.LoggerFactory; +@Deprecated public class Logger { - public static final boolean ENABLED = true; - //public static final boolean ECHO = Development.DEVELOPMENT || false; - public static final Properties defaultProperties = new Properties(); - static { - defaultProperties.put("log4j.rootCategory", "ERROR, default"); - defaultProperties.put("log4j.appender.default", "org.apache.log4j.FileAppender"); - defaultProperties.put("log4j.appender.default.File", InternalClientConfig.DB_CLIENT_LOG_FILE); - defaultProperties.put("log4j.appender.default.append", "true"); - defaultProperties.put("log4j.appender.default.layout", "org.apache.log4j.PatternLayout"); - defaultProperties.put("log4j.appender.default.layout.ConversionPattern", "%d{ISO8601} %-6r [%15.15t] %-5p %30.30c - %m%n"); - } - private static LogManager defaultLogManager = new LogManager(defaultProperties); - private static final Logger defaultErrorLogger = new Logger(LogManager.class); - private org.apache.log4j.Logger logger; - Logger(Class clazz) { - logger = defaultLogManager.getLogger(clazz); - } - - /** - * Log a trace event. - * - * @param message message of the trace - * @param exception the exception, or null - */ - public void logTrace(String message, Throwable exception) { - - if(!logger.isTraceEnabled()) return; - - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.trace(message, exception); - - if (Development.DEVELOPMENT) { - if(Development.getProperty(DevelopmentKeys.LOGGER_ECHO, Bindings.BOOLEAN)) { - System.err.println("Logger.logTrace: " + message); - } - } - - } - - /** - * Log an info event. - * - * @param message message of the info - * @param exception the exception, or null - */ - public void logInfo(String message, Throwable exception) { - - if(!logger.isInfoEnabled()) return; - - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.info(message, exception); - - if (Development.DEVELOPMENT) { - if(Development.getProperty(DevelopmentKeys.LOGGER_ECHO, Bindings.BOOLEAN)) { - System.err.println("Logger.logInfo: " + message); - } - } - - } - - /** - * Log an error event. - * - * @param message message of the error - * @param exception the exception, or null - */ - public void logError(String message, Throwable exception) { - - if(!logger.isEnabledFor(Level.ERROR)) return; - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.error(message, exception); + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Logger.class); + private static final String TODO_REPLACE_RIGHT_LOGGER = "[TODO: Replace with right logger instance]"; - if (Development.DEVELOPMENT) { - if(Development.getProperty(DevelopmentKeys.LOGGER_ECHO, Bindings.BOOLEAN)) { - System.err.println("Logger.logError: " + message); - } - } - - } - - /** - * Log an error event. - * - * @param message message of the error - * @param exception the exception, or null - */ - public void logWarning(String message, Throwable exception) { - - if(!logger.isEnabledFor(Level.WARN)) return; - - // Errors are much more useful with a stack trace! - if (exception == null) { - exception = new RuntimeException(); - } - logger.error(message, exception); - - if (Development.DEVELOPMENT) { - if(Development.getProperty(DevelopmentKeys.LOGGER_ECHO, Bindings.BOOLEAN)) { - System.err.println("Logger.logWarning: " + message); - } - } - - } - - /** - * Log message. - * - * @param message to log. - */ - public void logMessage(String message) { - Level level = logger.getLevel(); - boolean toggle = !logger.isInfoEnabled(); - if (toggle) - logger.setLevel((Level)Level.INFO); - logger.info(message); - if (toggle) - logger.setLevel(level); - if (Development.DEVELOPMENT) { - if(Development.getProperty(DevelopmentKeys.LOGGER_ECHO, Bindings.BOOLEAN)) { - System.err.println("Logger.logMessage: " + message); - } - } - } - - public static Logger getDefault() { - return defaultErrorLogger; - } - - public static LogManager getDefaultLogManager() { - return defaultLogManager; - } public static void defaultLogError(Throwable exception) { - if(!ENABLED) return; - getDefault().logError(exception.getLocalizedMessage(), exception); + LOGGER.error(TODO_REPLACE_RIGHT_LOGGER, exception); } public static void defaultLogError(String message) { - if(!ENABLED) return; - getDefault().logError(message, null); + LOGGER.error("{} {}", TODO_REPLACE_RIGHT_LOGGER, message); } public static void defaultLogError(String message, Throwable exception) { - if(!ENABLED) return; - getDefault().logError(message, exception); + LOGGER.error("{} {}", TODO_REPLACE_RIGHT_LOGGER, message, exception); } public static void defaultLogInfo(String message) { - if(!ENABLED) return; - getDefault().logInfo(message, null); - } - public static void defaultLogTrace(String message) { - if(!ENABLED) return; - getDefault().logTrace(message, null); - } - public static void defaultLog(String message) { - if(!ENABLED) return; - getDefault().logMessage(message); + LOGGER.info("{} {}", TODO_REPLACE_RIGHT_LOGGER, message); } } diff --git a/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Util.java b/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Util.java index 6d5012e2f..cc6c54bd2 100644 --- a/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Util.java +++ b/bundles/org.simantics.db.procore.ui/src/org/simantics/db/procore/ui/internal/Util.java @@ -39,7 +39,7 @@ public class Util { s += clazz.getSimpleName() + " called.\n"; if (null != message) s += message; - Logger.defaultLogTrace(s); + Logger.defaultLogInfo(s); } private static String NL = System.getProperty("line.separator"); static class Choice { diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/BuiltinSupportImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/BuiltinSupportImpl.java index cb13884fd..2a24c15ff 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/BuiltinSupportImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/BuiltinSupportImpl.java @@ -42,7 +42,6 @@ public class BuiltinSupportImpl implements BuiltinSupport { } private ResourceImpl getBuiltinResource(String name) throws DatabaseException { - Logger.defaultLogTrace("Asking for builtin " + name); synchronized (this) { if (null == builtinMap) { ClusterSupport cs = session.getService(ClusterSupport.class); @@ -55,7 +54,6 @@ public class BuiltinSupportImpl implements BuiltinSupport { synchronized (this) { builtin = builtinMap.get(name); if (null == builtin) { - Logger.defaultLogInfo("Asking for missing builtin " + name); return null; } if (null != builtin.weakResource) { diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterTable.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterTable.java index 6cab018a6..07df23df8 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterTable.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterTable.java @@ -27,7 +27,6 @@ import org.simantics.db.Database; import org.simantics.db.Database.Session.ClusterChanges; import org.simantics.db.DevelopmentKeys; import org.simantics.db.SessionVariables; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.ClusterDoesNotExistException; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ResourceNotFoundException; @@ -48,6 +47,7 @@ import org.simantics.db.service.ClusterCollectorPolicy; import org.simantics.db.service.ClusterCollectorPolicy.CollectorCluster; import org.simantics.db.service.ClusterUID; import org.simantics.utils.Development; +import org.slf4j.LoggerFactory; import fi.vtt.simantics.procore.DebugPolicy; import fi.vtt.simantics.procore.internal.ClusterControlImpl.ClusterStateImpl; @@ -61,6 +61,8 @@ import gnu.trove.set.hash.TIntHashSet; public final class ClusterTable implements IClusterTable { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(ClusterTable.class); + private static final boolean VALIDATE_SIZE = false; int maximumBytes = 128 * 1024 * 1024; @@ -280,7 +282,7 @@ public final class ClusterTable implements IClusterTable { ClusterImpl cluster = ClusterImpl.make(clusterUID, clusterKey, sessionImpl.clusterTranslator); clusters.create(cluster); if (!cluster.isLoaded()) - Logger.defaultLogError(new Exception("Bug in ClusterTable.makeCluster(long, boolean), cluster not loaded")); + LOGGER.error("", new Exception("Bug in ClusterTable.makeCluster(long, boolean), cluster not loaded")); importanceMap.put(cluster.getImportance(), new ImportanceEntry(cluster)); if (VALIDATE_SIZE) validateSize("makeCluster"); @@ -320,7 +322,7 @@ public final class ClusterTable implements IClusterTable { clusters.replace((ClusterImpl)cluster); if (!cluster.isLoaded()) - Logger.defaultLogError(new Exception("Bug in ClusterTable.replaceCluster(ClusterI), cluster not loaded")); + LOGGER.error("", new Exception("Bug in ClusterTable.replaceCluster(ClusterI), cluster not loaded")); importanceMap.put(cluster.getImportance(), new ImportanceEntry((ClusterImpl)cluster)); if(collectorPolicy != null) collectorPolicy.added((ClusterImpl)cluster); @@ -396,7 +398,7 @@ public final class ClusterTable implements IClusterTable { result += cluster.getCachedSize(); } } catch (Throwable t) { - Logger.defaultLogError(t); + LOGGER.error("Could not calculate size", t); } } return true; @@ -696,12 +698,12 @@ public final class ClusterTable implements IClusterTable { final long getClusterIdByResourceKeyNoThrow(final int resourceKey) { int clusterKey = ClusterTraitsBase.getClusterKeyFromResourceKeyNoThrow(resourceKey); if (ClusterTraitsBase.isVirtualClusterKey(clusterKey)) { - Logger.defaultLogError("Tried to get a persistent cluster for a virtual resource. key=" + resourceKey); + LOGGER.error("Tried to get a persistent cluster for a virtual resource. key=" + resourceKey); return 0; } ClusterI c = clusterArray[clusterKey]; if (c == null) { - Logger.defaultLogError("No cluster for key " + resourceKey); + LOGGER.error("No cluster for key " + resourceKey); return 0; } return c.getClusterId(); @@ -759,14 +761,14 @@ public final class ClusterTable implements IClusterTable { collectorPolicy.removed(oldCluster); clusters.replace(newCluster); if (!newCluster.isLoaded()) - Logger.defaultLogError(new Exception("Bug in ClusterTable.refresh, cluster not loaded")); + LOGGER.error("", new Exception("Bug in ClusterTable.refresh, cluster not loaded")); importanceMap.put(newCluster.getImportance(), new ImportanceEntry(newCluster)); if (collectorPolicy != null) collectorPolicy.added(newCluster); // Now we have fetched the new cluster but to emulate effects of the changes in it we fetch the cluster changes from server. refreshCluster(csid, session, oldCluster, clusterUID[i], newCluster.clusterId, clusterKey); } catch (Throwable t) { - Logger.defaultLogError("Failed to load cluster in refresh.", t); + LOGGER.error("Failed to load cluster in refresh.", t); } } if (VALIDATE_SIZE) @@ -803,7 +805,7 @@ public final class ClusterTable implements IClusterTable { try { cc = session.graphSession.getClusterChanges(clusterUID, csid); } catch (Exception e) { - Logger.defaultLogError("Could not get cluster changes. cluster=" + clusterUID, e); + LOGGER.error("Could not get cluster changes. cluster=" + clusterUID, e); release(clusterId); return; } @@ -840,7 +842,7 @@ public final class ClusterTable implements IClusterTable { // System.err.println("refreshImportance " + c.getClusterId() + " => " + newImportance); c.setImportance(newImportance); if (!c.isLoaded()) - Logger.defaultLogError(new Exception("Bug in ClusterTable.refreshImportance(ClusterImpl), cluster not loaded")); + LOGGER.error("", new Exception("Bug in ClusterTable.refreshImportance(ClusterImpl), cluster not loaded")); importanceMap.put(c.getImportance(), new ImportanceEntry(c)); if(collectorPolicy != null) collectorPolicy.added(c); @@ -889,7 +891,7 @@ public final class ClusterTable implements IClusterTable { cluster = load2(cs.getClusterId(), cs.getClusterKey()); } } catch (DatabaseException e) { - Logger.defaultLogError(e); + LOGGER.error("Could not load cluster", e); if (DebugPolicy.REPORT_CLUSTER_EVENTS) e.printStackTrace(); String msg = "Failed to load cluster " + cs.getClusterUID();// + " resourceId=" + (((cs.getClusterId() << 16 + (resourceKey & 65535)))); @@ -913,7 +915,7 @@ public final class ClusterTable implements IClusterTable { return (T) c; } if (!(c instanceof ClusterSmall)) { - Logger.defaultLogError("Proxy must be instance of ClusterSmall"); + LOGGER.error("Proxy must be instance of ClusterSmall"); return null; } return ensureLoaded((T)c); @@ -933,7 +935,7 @@ public final class ClusterTable implements IClusterTable { return (T) c; } if (!(c instanceof ClusterSmall)) { - Logger.defaultLogError("Proxy must be instance of ClusterSmall"); + LOGGER.error("Proxy must be instance of ClusterSmall"); return null; } ClusterI cluster; @@ -947,7 +949,7 @@ public final class ClusterTable implements IClusterTable { int resourceIndex = resourceKey & ClusterTraitsBase.getResourceIndexFromResourceKeyNoThrow(resourceKey); long resourceId = ClusterTraitsBase.createResourceIdNoThrow(cs.getClusterId(), resourceIndex); String msg = "Failed to load cluster " + cs.getClusterUID() + " for resource key " + resourceKey + " resourceIndex=" + resourceIndex + " resourceId=" + resourceId; - Logger.defaultLogError(msg, e); + LOGGER.error(msg, e); c.setDeleted(true, null); return (T)c; } @@ -993,7 +995,7 @@ public final class ClusterTable implements IClusterTable { try { s.acquire(); } catch (InterruptedException e) { - Logger.defaultLogError(e); + LOGGER.error("unable to acquire", e); } if (null != ex[0]) throw ex[0]; @@ -1096,7 +1098,7 @@ public final class ClusterTable implements IClusterTable { } catch (Throwable t) { // It's totally legal to call for non-existing cluster. // Sometimes this indicates an error, though. - Logger.getDefault().logInfo("Load cluster failed.", t); + LOGGER.error("Load cluster failed", t); if (t instanceof DatabaseException) e = (DatabaseException) t; else diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/GraphSessionSocket.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/GraphSessionSocket.java index 9a94d8345..724195da1 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/GraphSessionSocket.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/GraphSessionSocket.java @@ -81,9 +81,7 @@ final class GraphSessionSocket extends GraphSession { @Override public long reserveIds(int count) throws DatabaseException { - Logger.defaultLogTrace("Asking for ids " + count + "."); long firstId = dbSession.reserveIds(count); - Logger.defaultLogTrace("First id is " + firstId + "."); if (DebugPolicy.REPORT_CLUSTER_ID_ALLOCATION) System.out.println("Client reserves new ids [" + firstId + " - " + (firstId+count-1) + "] from server."); return firstId; diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ResourceTable.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ResourceTable.java index d0619976d..1587bc805 100644 --- a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ResourceTable.java +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ResourceTable.java @@ -14,7 +14,6 @@ package org.simantics.db.procore.cluster; import java.util.ArrayList; import org.simantics.db.Resource; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ExternalValueException; import org.simantics.db.exception.ValidationException; @@ -32,10 +31,11 @@ import org.simantics.db.impl.Table; import org.simantics.db.impl.TableFactory; import org.simantics.db.impl.TableSizeListener; import org.simantics.db.impl.graph.ReadGraphImpl; -import org.simantics.db.procedure.AsyncContextMultiProcedure; import org.simantics.db.procedure.SyncContextMultiProcedure; import org.simantics.db.procedure.SyncMultiProcedure; import org.simantics.db.procore.cluster.PredicateTable.Status; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; final class ResourceElement { @@ -1176,6 +1176,8 @@ class Statement { class CalculateStatements implements ClusterI.PredicateProcedure { + + private static final Logger LOGGER = LoggerFactory.getLogger(CalculateStatements.class); private ObjectTable ot; private final int sRef; @@ -1192,8 +1194,8 @@ implements ClusterI.PredicateProcedure { try { oIndex = ClusterTraits.statementIndexGet(oIndex); } catch (DatabaseException e) { - Logger.getDefault().logError("Missing object set for s=" - + sRef + " p=" + pKey, null); + LOGGER.error("Missing object set for s=" + + sRef + " p=" + pKey, e); return false; // continue looping } int osize = ot.getObjectSetSize(oIndex); diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ResourceTableSmall.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ResourceTableSmall.java index 0278b1531..460d30dbe 100644 --- a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ResourceTableSmall.java +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ResourceTableSmall.java @@ -14,7 +14,6 @@ package org.simantics.db.procore.cluster; import java.util.ArrayList; import org.simantics.db.Resource; -import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.impl.ClusterBase; import org.simantics.db.impl.ClusterI; @@ -31,6 +30,8 @@ import org.simantics.db.impl.graph.ReadGraphImpl; import org.simantics.db.procedure.SyncContextMultiProcedure; import org.simantics.db.procedure.SyncMultiProcedure; import org.simantics.db.procore.cluster.PredicateTable.Status; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @@ -390,6 +391,9 @@ public final class ResourceTableSmall extends Table { class CalculateStatementsSmall implements ClusterI.PredicateProcedure { + + private static final Logger LOGGER = LoggerFactory.getLogger(CalculateStatementsSmall.class); + private ObjectTable ot; private final int sRef; @@ -406,8 +410,8 @@ implements ClusterI.PredicateProcedure { try { oIndex = ClusterTraits.statementIndexGet(oIndex); } catch (DatabaseException e) { - Logger.getDefault().logError("Missing object set for s=" - + sRef + " p=" + pKey, null); + LOGGER.error("Missing object set for s=" + + sRef + " p=" + pKey, e); return false; // continue looping } int osize = ot.getObjectSetSize(oIndex); diff --git a/bundles/org.simantics.db.server/META-INF/MANIFEST.MF b/bundles/org.simantics.db.server/META-INF/MANIFEST.MF index 0fcdaca67..c0ab9c738 100644 --- a/bundles/org.simantics.db.server/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.db.server/META-INF/MANIFEST.MF @@ -22,5 +22,6 @@ Import-Package: gnu.trove.impl.hash, Bundle-ActivationPolicy: lazy Require-Bundle: org.simantics.databoard, org.simantics.db, - org.simantics.fastlz + org.simantics.fastlz, + org.slf4j.api Eclipse-BundleShape: dir diff --git a/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/ConnectionManager.java b/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/ConnectionManager.java index e9446de46..8eb46f5df 100644 --- a/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/ConnectionManager.java +++ b/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/ConnectionManager.java @@ -473,7 +473,7 @@ class Connection { // System.err.println("############### YIELD ##############################"); Thread.yield(); if (left > 0) - Logger.defaultLogTrace("Could not send the whole byte buffer, left count = " + left + ", buffer remaining = " + byteBuffer.remaining() + Logger.defaultLogInfo("Could not send the whole byte buffer, left count = " + left + ", buffer remaining = " + byteBuffer.remaining() + ", write return =" + n); } } diff --git a/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/DatabaseI.java b/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/DatabaseI.java index 79057d58a..2f3187d5a 100644 --- a/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/DatabaseI.java +++ b/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/DatabaseI.java @@ -43,8 +43,12 @@ import org.simantics.db.server.ProCoreException; import org.simantics.db.server.internal.ProCoreServer.TailFile; import org.simantics.db.server.protocol.MessageNumber; import org.simantics.db.server.protocol.MessageText; +import org.slf4j.LoggerFactory; public class DatabaseI implements Database { + + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(DatabaseI.class); + private static String NL = System.getProperty("line.separator"); private static String TEMP_PREFIX = "db.temp."; public static DatabaseI newDatabaseI(File dbFolder) { @@ -336,7 +340,7 @@ public class DatabaseI implements Database { } long nextFreeId = getNextClusterId(db); boolean cleanHead = Files.isDirectory(dbHead) && !isFolderEmpty(dbHead); - Logger.defaultLog("Purging old history and exit information. folder=" + db); + LOGGER.info("Purging old history and exit information. folder=" + db); if (cleanHead) { deleteClusters(dbHead, dbTail); movePath(dbHead, dbTail, ProCoreServer.TAIL_FILE, FileOption.OVERWRITE); diff --git a/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/ProCoreServer.java b/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/ProCoreServer.java index 7ee66e182..cf1eb18ac 100644 --- a/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/ProCoreServer.java +++ b/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/ProCoreServer.java @@ -44,6 +44,7 @@ import org.simantics.db.server.ServerNotFoundException; import org.simantics.db.server.protocol.CloseClientSessionFunction; import org.simantics.db.server.protocol.ExecuteFunction; import org.simantics.db.server.protocol.MessageNumber; +import org.slf4j.LoggerFactory; public class ProCoreServer { private static Map workingDirs = new HashMap(); @@ -378,7 +379,7 @@ public class ProCoreServer { msg.append(nl); msg.append("svn id=$Id: ProCoreServer.java r31684 2015-09-10 13:45:00Z $"); String str = msg.toString(); - Logger.defaultLog(str); + LoggerFactory.getLogger(ProCoreServer.class).info(str); } private static String[] getFileLines(final File aFile, int maxLines) { final String[] STRING_EMPTY_ARRAY = new String[0]; diff --git a/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/Util.java b/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/Util.java index c09be04a2..b0bfd1672 100644 --- a/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/Util.java +++ b/bundles/org.simantics.db.server/src/org/simantics/db/server/internal/Util.java @@ -21,10 +21,10 @@ public class Util { s += clazz.getSimpleName() + " called.\n"; if (null != message) s += message; - Logger.defaultLogTrace(s); + Logger.defaultLogInfo(s); } public static void log(String message) { - Logger.defaultLog(message); + Logger.defaultLogInfo(message); } public static void showDebug(String message) { String t = "DEBUG: " + message; -- 2.47.1