From 590c509e2a7606d8268819457b957ce0550bd3ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Tue, 3 Jan 2017 13:13:34 +0200 Subject: [PATCH] Replaces stdout/stderr by logging in certain places refs #6938 Change-Id: I88f7b5459884d2eddb2624e45d4e1fddedbd5b0c --- bundles/org.simantics.acorn/META-INF/MANIFEST.MF | 3 ++- .../src/org/simantics/acorn/ClusterManager.java | 8 ++++++-- bundles/org.simantics.graph.db/META-INF/MANIFEST.MF | 3 ++- .../src/org/simantics/graph/db/TransferableGraphs.java | 5 ++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/bundles/org.simantics.acorn/META-INF/MANIFEST.MF b/bundles/org.simantics.acorn/META-INF/MANIFEST.MF index 9152acafd..28c851cb0 100644 --- a/bundles/org.simantics.acorn/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.acorn/META-INF/MANIFEST.MF @@ -11,7 +11,8 @@ Require-Bundle: gnu.trove3;bundle-version="3.0.0", org.simantics.compressions;bundle-version="1.0.0", org.simantics.backup, org.eclipse.core.runtime;bundle-version="3.11.1", - org.simantics.db.procore + org.simantics.db.procore, + org.slf4j.api;bundle-version="1.7.2" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-Activator: org.simantics.acorn.internal.Activator diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java index b2a30953c..c414dd2b6 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/ClusterManager.java @@ -35,8 +35,12 @@ import org.simantics.db.service.ClusterSetsSupport; import org.simantics.db.service.ClusterUID; import org.simantics.utils.threads.logger.ITask; import org.simantics.utils.threads.logger.ThreadLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ClusterManager { + + final static Logger LOGGER = LoggerFactory.getLogger(ClusterManager.class); private ArrayList currentChanges = new ArrayList(); @@ -148,7 +152,7 @@ public class ClusterManager { return false; } - System.err.println("makeSnapshot"); + LOGGER.info("makeSnapshot"); // Schedule writing of all data to disk refreshHeadState(); @@ -173,7 +177,7 @@ public class ClusterManager { amountOfFiles = countFiles(workingDirectory); - System.err.println(" -finished: amount of files is " + amountOfFiles); + LOGGER.info(" -finished: amount of files is {}", amountOfFiles); workingDirectory = dbFolder.resolve(Integer.toString(mainState.headDir)); if (!Files.exists(workingDirectory)) { diff --git a/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF b/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF index 20c651f5c..f21b3e776 100644 --- a/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.graph.db/META-INF/MANIFEST.MF @@ -7,7 +7,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Require-Bundle: org.simantics.graph;bundle-version="1.0.0";visibility:=reexport, org.simantics.db.common;bundle-version="0.8.0", gnu.trove3;bundle-version="3.0.3", - org.simantics.layer0;bundle-version="1.0.0" + org.simantics.layer0;bundle-version="1.0.0", + org.slf4j.api;bundle-version="1.7.2" Export-Package: org.simantics.graph.db, org.simantics.graph.db.old Bundle-Vendor: VTT Technical Research Centre of Finland diff --git a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java index edcbc51d8..bdfd3de6e 100644 --- a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java +++ b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java @@ -62,11 +62,14 @@ import org.simantics.graph.representation.Identity; import org.simantics.graph.representation.TransferableGraph1; import org.simantics.graph.representation.Value; import org.simantics.utils.datastructures.BinaryFunction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.list.array.TIntArrayList; import gnu.trove.map.hash.TObjectIntHashMap; public class TransferableGraphs { + final static Logger LOGGER = LoggerFactory.getLogger(TransferableGraphs.class); public static long[] importGraph(Session session, Object tg, IImportAdvisor advisor) throws DatabaseException, TransferableGraphException { if (tg instanceof TransferableGraph1) @@ -579,7 +582,7 @@ public class TransferableGraphs { }); long end = System.nanoTime(); - System.err.println("Wrote transferable graph in " + 1e-9*(end-start) + " seconds."); + LOGGER.info("Wrote transferable graph in {} seconds.", 1e-9*(end-start)); } public static TransferableGraph1 create(ReadGraph graph, TransferableGraphSource source) throws DatabaseException { -- 2.43.2