From 45ffbe758fbfa5acc73aebaf531e397ffc7a97b7 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Tue, 18 Aug 2020 12:13:08 +0300 Subject: [PATCH] Switched from log4j to slf4j to remove all log4j dependencies gitlab simantics/platform#579 Change-Id: I50a49d736b42dc5b351314a8ff122dd85c078f15 --- .../org.simantics.objmap/META-INF/MANIFEST.MF | 2 +- .../factories/UpdateMethodFactory.java | 7 +++--- .../org/simantics/objmap/impl/Mapping.java | 25 ++++++++++--------- .../objmap/rules/MappedElementRule.java | 9 ++++--- .../objmap/rules/MappedElementsRule.java | 9 ++++--- .../org/simantics/objmap/rules/ValueRule.java | 9 ++++--- .../objmap/rules/domain/MappingUtils.java | 9 ++++--- .../domain/RelatedListElementsAccessor.java | 9 ++++--- .../rules/domain/RelatedObjectAccessor.java | 9 ++++--- .../rules/domain/RelatedObjectsAccessor.java | 9 ++++--- .../RelatedOrderedSetElementsAccessor.java | 9 ++++--- .../rules/domain/RelatedValueAccessor.java | 9 ++++--- .../objmap/rules/range/FieldAccessor.java | 9 ++++--- .../objmap/schema/SimpleLinkType.java | 13 +++++----- .../META-INF/MANIFEST.MF | 1 - .../org/simantics/sysdyn/ui/Activator.java | 12 +-------- 16 files changed, 76 insertions(+), 74 deletions(-) diff --git a/bundles/org.simantics.objmap/META-INF/MANIFEST.MF b/bundles/org.simantics.objmap/META-INF/MANIFEST.MF index fb209ef6..3549fa61 100644 --- a/bundles/org.simantics.objmap/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.objmap/META-INF/MANIFEST.MF @@ -5,7 +5,7 @@ Bundle-SymbolicName: org.simantics.objmap Bundle-Version: 0.1.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: gnu.trove3;bundle-version="3.0.3", - org.apache.log4j;bundle-version="1.2.15", + org.slf4j.api, org.simantics.layer0;bundle-version="1.0.0", org.simantics.db.common;bundle-version="1.1.0" Export-Package: org.simantics.objmap, diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/annotations/factories/UpdateMethodFactory.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/annotations/factories/UpdateMethodFactory.java index 5cab576f..0a0b2191 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/annotations/factories/UpdateMethodFactory.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/annotations/factories/UpdateMethodFactory.java @@ -14,7 +14,6 @@ package org.simantics.objmap.annotations.factories; import java.lang.annotation.Annotation; import java.lang.reflect.Method; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -23,10 +22,12 @@ import org.simantics.objmap.IFunction; import org.simantics.objmap.IMappingRule; import org.simantics.objmap.MappingException; import org.simantics.objmap.rules.factory.IMethodRuleFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class UpdateMethodFactory implements IMethodRuleFactory { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); @Override public IMappingRule create(ReadGraph g, @@ -40,7 +41,7 @@ public class UpdateMethodFactory implements IMethodRuleFactory { public boolean updateRange(ReadGraph g, IFunction map, Resource domainElement, Object rangeElement) throws MappingException { - LOGGER.info(" UpdateMethodFactory.updateRange"); + LOGGER.trace(" UpdateMethodFactory.updateRange"); try { return (Boolean)method.invoke(rangeElement, g, domainElement); } catch (Exception e) { diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/impl/Mapping.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/impl/Mapping.java index 7db9a28d..2f1e9c51 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/impl/Mapping.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/impl/Mapping.java @@ -11,17 +11,12 @@ *******************************************************************************/ package org.simantics.objmap.impl; -import gnu.trove.map.hash.TCustomHashMap; -import gnu.trove.map.hash.THashMap; -import gnu.trove.strategy.IdentityHashingStrategy; - import java.util.AbstractSet; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Set; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -32,6 +27,12 @@ import org.simantics.objmap.IMapping; import org.simantics.objmap.IMappingListener; import org.simantics.objmap.IMappingSchema; import org.simantics.objmap.MappingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import gnu.trove.map.hash.TCustomHashMap; +import gnu.trove.map.hash.THashMap; +import gnu.trove.strategy.IdentityHashingStrategy; /** * An implementation of IMapping. The class should not be created @@ -41,7 +42,7 @@ import org.simantics.objmap.MappingException; */ public class Mapping implements IMapping { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); IMappingSchema schema; @@ -69,7 +70,7 @@ public class Mapping implements IMapping { } private void createDomain(WriteGraph g, Link link) throws MappingException { - LOGGER.info(" createDomain for " + link.rangeElement); + LOGGER.trace(" createDomain for " + link.rangeElement); ILinkType type = schema.linkTypeOfRangeElement(link.rangeElement); Resource domainElement = type.createDomainElement(g, link.rangeElement); @@ -228,11 +229,11 @@ public class Mapping implements IMapping { @Override public synchronized Collection updateDomain(WriteGraph g) throws MappingException { - LOGGER.info("Mapping.updateDomain"); + LOGGER.trace("Mapping.updateDomain"); RangeToDomain map = new RangeToDomain(g); ArrayList updated = new ArrayList(); while(!modifiedRangeLinks.isEmpty()) { - LOGGER.info(" modifiedRangeLinks.size() = " + modifiedRangeLinks.size()); + LOGGER.trace(" modifiedRangeLinks.size() = " + modifiedRangeLinks.size()); Link link = modifiedRangeLinks.remove(modifiedRangeLinks.size()-1); link.rangeModified = false; @@ -253,11 +254,11 @@ public class Mapping implements IMapping { @Override public synchronized Collection updateRange(ReadGraph g) throws MappingException { - LOGGER.info("Mapping.updateRange"); + LOGGER.trace("Mapping.updateRange"); DomainToRange map = new DomainToRange(g); ArrayList updated = new ArrayList(); while(!modifiedDomainLinks.isEmpty()) { - LOGGER.info(" modifiedDomainLinks.size() = " + modifiedDomainLinks.size()); + LOGGER.trace(" modifiedDomainLinks.size() = " + modifiedDomainLinks.size()); Link link = modifiedDomainLinks.remove(modifiedDomainLinks.size()-1); link.domainModified = false; @@ -322,7 +323,7 @@ public class Mapping implements IMapping { void domainModified(Link link) { if(!link.domainModified) { synchronized(modifiedDomainLinks) { - LOGGER.info(" domainModified for " + link.rangeElement); + LOGGER.trace(" domainModified for " + link.rangeElement); link.domainModified = true; modifiedDomainLinks.add(link); if(modifiedDomainLinks.size() == 1) { diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementRule.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementRule.java index 9ce33598..21bb3315 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementRule.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementRule.java @@ -11,7 +11,6 @@ *******************************************************************************/ package org.simantics.objmap.rules; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -20,6 +19,8 @@ import org.simantics.objmap.IMappingRule; import org.simantics.objmap.MappingException; import org.simantics.objmap.rules.domain.IDomainAccessor; import org.simantics.objmap.rules.range.IRangeAccessor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A rule that synchronizes collection of elements between @@ -29,7 +30,7 @@ import org.simantics.objmap.rules.range.IRangeAccessor; */ public class MappedElementRule implements IMappingRule { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); IDomainAccessor domainAccessor; IRangeAccessor rangeAccessor; @@ -44,7 +45,7 @@ public class MappedElementRule implements IMappingRule { public boolean updateDomain(WriteGraph g, IFunction map, Resource domainElement, Object rangeElement) throws MappingException { - LOGGER.info(" MappedElementRule.updateDomain"); + LOGGER.trace(" MappedElementRule.updateDomain"); Object value = rangeAccessor.get(rangeElement); Resource mappedValue = value == null ? null : map.get(value); return domainAccessor.set(g, domainElement, mappedValue); @@ -54,7 +55,7 @@ public class MappedElementRule implements IMappingRule { public boolean updateRange(ReadGraph g, IFunction map, Resource domainElement, Object rangeElement) throws MappingException { - LOGGER.info(" MappedElementRule.updateRange"); + LOGGER.trace(" MappedElementRule.updateRange"); Resource value = domainAccessor.get(g, domainElement); Object mappedValue = value == null ? null : map.get(value); return rangeAccessor.set(rangeElement, mappedValue); diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementsRule.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementsRule.java index 750926d4..8a9cc38c 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementsRule.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/MappedElementsRule.java @@ -14,7 +14,6 @@ package org.simantics.objmap.rules; import java.util.ArrayList; import java.util.Collection; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -23,6 +22,8 @@ import org.simantics.objmap.IMappingRule; import org.simantics.objmap.MappingException; import org.simantics.objmap.rules.domain.IDomainAccessor; import org.simantics.objmap.rules.range.IRangeAccessor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A rule that synchronizes collection of elements between @@ -32,7 +33,7 @@ import org.simantics.objmap.rules.range.IRangeAccessor; */ public class MappedElementsRule implements IMappingRule { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); IDomainAccessor> domainAccessor; IRangeAccessor> rangeAccessor; @@ -47,7 +48,7 @@ public class MappedElementsRule implements IMappingRule { public boolean updateDomain(WriteGraph g, IFunction map, Resource domainElement, Object rangeElement) throws MappingException { - LOGGER.info(" MappedElementsRule.updateDomain"); + LOGGER.trace(" MappedElementsRule.updateDomain"); // Snapshot the accessed range value for concurrency safety. // NOTE: still assumes that the accessed collection is concurrent or // synchronized for toArray to be atomic. @@ -63,7 +64,7 @@ public class MappedElementsRule implements IMappingRule { public boolean updateRange(ReadGraph g, IFunction map, Resource domainElement, Object rangeElement) throws MappingException { - LOGGER.info(" MappedElementsRule.updateRange"); + LOGGER.trace(" MappedElementsRule.updateRange"); Collection value = domainAccessor.get(g, domainElement); ArrayList mappedValue = new ArrayList(value.size()); for(Resource r : value) diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/ValueRule.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/ValueRule.java index 8135d2d0..3ea8c35a 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/ValueRule.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/ValueRule.java @@ -11,7 +11,6 @@ *******************************************************************************/ package org.simantics.objmap.rules; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -20,6 +19,8 @@ import org.simantics.objmap.IMappingRule; import org.simantics.objmap.MappingException; import org.simantics.objmap.rules.domain.IDomainAccessor; import org.simantics.objmap.rules.range.IRangeAccessor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A rule that synchronizes values between domain and @@ -28,7 +29,7 @@ import org.simantics.objmap.rules.range.IRangeAccessor; */ public class ValueRule implements IMappingRule { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); IDomainAccessor domainAccessor; IRangeAccessor rangeAccessor; @@ -43,7 +44,7 @@ public class ValueRule implements IMappingRule { public boolean updateDomain(WriteGraph g, IFunction map, Resource domainElement, Object rangeElement) throws MappingException { - LOGGER.info(" ValueRule.updateDomain"); + LOGGER.trace(" ValueRule.updateDomain"); Object value = rangeAccessor.get(rangeElement); return domainAccessor.set(g, domainElement, value); } @@ -52,7 +53,7 @@ public class ValueRule implements IMappingRule { public boolean updateRange(ReadGraph g, IFunction map, Resource domainElement, Object rangeElement) throws MappingException { - LOGGER.info(" ValueRule.updateRange"); + LOGGER.trace(" ValueRule.updateRange"); Object value = domainAccessor.get(g, domainElement); return rangeAccessor.set(rangeElement, value); } diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/MappingUtils.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/MappingUtils.java index 927d0121..e378d86d 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/MappingUtils.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/MappingUtils.java @@ -14,10 +14,11 @@ package org.simantics.objmap.rules.domain; import java.util.Arrays; import java.util.Collection; -import org.apache.log4j.Logger; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Static utility methods for rule implementations. @@ -25,7 +26,7 @@ import org.simantics.db.exception.DatabaseException; */ public class MappingUtils { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); /** * Adds and removes statements to/from the database so that objects @@ -47,7 +48,7 @@ public class MappingUtils { while(true) { int cmp = currentObjects[i].compareTo(objects[j]); if(cmp < 0) { - LOGGER.info(" remove statement"); + LOGGER.trace(" remove statement"); if(deleteExtraObjects) g.deny(currentObjects[i]); else @@ -58,7 +59,7 @@ public class MappingUtils { break; } else if(cmp > 0) { - LOGGER.info(" add statement"); + LOGGER.trace(" add statement"); g.claim(subject, predicate, objects[j]); modified = true; ++j; diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedListElementsAccessor.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedListElementsAccessor.java index 59b544f0..b0841fc6 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedListElementsAccessor.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedListElementsAccessor.java @@ -14,17 +14,18 @@ package org.simantics.objmap.rules.domain; import java.util.Collection; import java.util.Collections; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.utils.ListUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.objmap.MappingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RelatedListElementsAccessor implements IDomainAccessor> { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); Resource relation; @@ -36,7 +37,7 @@ public class RelatedListElementsAccessor implements IDomainAccessor get(ReadGraph g, Resource element) throws MappingException { try { - LOGGER.info(" RelatedListElementsAccessor.get"); + LOGGER.trace(" RelatedListElementsAccessor.get"); Resource listResource = g.getPossibleObject(element, relation); if(listResource != null) return ListUtils.toList(g, listResource); @@ -51,7 +52,7 @@ public class RelatedListElementsAccessor implements IDomainAccessor value) throws MappingException { try { - LOGGER.info(" RelatedListElementsAccessor.set"); + LOGGER.trace(" RelatedListElementsAccessor.set"); Resource listResource = g.getPossibleObject(element, relation); if(listResource != null) ListUtils.createExisting(g, listResource, value); diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectAccessor.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectAccessor.java index 10761d6c..b65fec5f 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectAccessor.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectAccessor.java @@ -11,12 +11,13 @@ *******************************************************************************/ package org.simantics.objmap.rules.domain; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.objmap.MappingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Accesses a resource attached to the element by given functional relation. @@ -24,7 +25,7 @@ import org.simantics.objmap.MappingException; */ public class RelatedObjectAccessor implements IDomainAccessor { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); Resource relation; @@ -35,7 +36,7 @@ public class RelatedObjectAccessor implements IDomainAccessor { @Override public Resource get(ReadGraph g, Resource element) throws MappingException { try { - LOGGER.info(" RelatedObjectAccessor.get"); + LOGGER.trace(" RelatedObjectAccessor.get"); return g.getPossibleObject(element, relation); } catch (DatabaseException e) { throw new MappingException(e); @@ -46,7 +47,7 @@ public class RelatedObjectAccessor implements IDomainAccessor { public boolean set(WriteGraph g, Resource element, Resource value) throws MappingException { try { - LOGGER.info(" RelatedObjectAccessor.set"); + LOGGER.trace(" RelatedObjectAccessor.set"); Resource resource = g.getPossibleObject(element, relation); if(resource == null) { if(value == null) diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectsAccessor.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectsAccessor.java index c7b6cabb..fadfc354 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectsAccessor.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedObjectsAccessor.java @@ -13,12 +13,13 @@ package org.simantics.objmap.rules.domain; import java.util.Collection; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.objmap.MappingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Accesses the set of objects attached to the element by the given relation. @@ -26,7 +27,7 @@ import org.simantics.objmap.MappingException; */ public class RelatedObjectsAccessor implements IDomainAccessor> { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); Resource relation; boolean deleteExtraObjects; @@ -40,7 +41,7 @@ public class RelatedObjectsAccessor implements IDomainAccessor get(ReadGraph g, Resource element) throws MappingException { try { - LOGGER.info(" RelatedObjectsAccessor.get"); + LOGGER.trace(" RelatedObjectsAccessor.get"); return g.getObjects(element, relation); } catch (DatabaseException e) { throw new MappingException(e); @@ -51,7 +52,7 @@ public class RelatedObjectsAccessor implements IDomainAccessor value) throws MappingException { try { - LOGGER.info(" RelatedObjectsAccessor.set"); + LOGGER.trace(" RelatedObjectsAccessor.set"); return MappingUtils.synchronizeStatements(g, element, relation, value.toArray(new Resource[value.size()]), deleteExtraObjects); } catch (DatabaseException e) { diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedOrderedSetElementsAccessor.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedOrderedSetElementsAccessor.java index 35c5e3f8..6b0947d6 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedOrderedSetElementsAccessor.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedOrderedSetElementsAccessor.java @@ -14,13 +14,14 @@ package org.simantics.objmap.rules.domain; import java.util.Collection; import java.util.Collections; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.common.utils.OrderedSetUtils; import org.simantics.db.exception.DatabaseException; import org.simantics.objmap.MappingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Accesses the set of objects attached to the element by the given relation. @@ -28,7 +29,7 @@ import org.simantics.objmap.MappingException; */ public class RelatedOrderedSetElementsAccessor implements IDomainAccessor> { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); boolean deleteExtraObjects; @@ -40,7 +41,7 @@ public class RelatedOrderedSetElementsAccessor implements IDomainAccessor get(ReadGraph g, Resource element) throws MappingException { try { - LOGGER.info(" RelatedOrderedSetElementsAccessor.get"); + LOGGER.trace(" RelatedOrderedSetElementsAccessor.get"); if(g.hasStatement(element)) return OrderedSetUtils.toList(g, element); else @@ -54,7 +55,7 @@ public class RelatedOrderedSetElementsAccessor implements IDomainAccessor value) throws MappingException { try { - LOGGER.info(" RelatedOrderedSetElementsAccessor.set"); + LOGGER.trace(" RelatedOrderedSetElementsAccessor.set"); return OrderedSetUtils.set(g, element, value); // FIXME Implement deleteExtraObjects } catch (DatabaseException e) { diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java index 4cf7ecde..214c1688 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/domain/RelatedValueAccessor.java @@ -11,13 +11,14 @@ *******************************************************************************/ package org.simantics.objmap.rules.domain; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.layer0.Layer0; import org.simantics.objmap.MappingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Accesses a value attached to the element by given functional relation. @@ -25,7 +26,7 @@ import org.simantics.objmap.MappingException; */ public class RelatedValueAccessor implements IDomainAccessor { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); Resource relation; Resource valueType; @@ -38,7 +39,7 @@ public class RelatedValueAccessor implements IDomainAccessor { @Override public Object get(ReadGraph g, Resource element) throws MappingException { try { - LOGGER.info(" RelatedValueAccessor.get"); + LOGGER.trace(" RelatedValueAccessor.get"); Resource valueResource = g.getPossibleObject(element, relation); if(valueResource == null) return null; @@ -52,7 +53,7 @@ public class RelatedValueAccessor implements IDomainAccessor { public boolean set(WriteGraph g, Resource element, Object value) throws MappingException { try { - LOGGER.info(" RelatedValueAccessor.set"); + LOGGER.trace(" RelatedValueAccessor.set"); Resource valueResource = g.getPossibleObject(element, relation); if(valueResource == null) { if(value == null) diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/range/FieldAccessor.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/range/FieldAccessor.java index e731e3e9..23246c23 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/range/FieldAccessor.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/rules/range/FieldAccessor.java @@ -13,8 +13,9 @@ package org.simantics.objmap.rules.range; import java.lang.reflect.Field; -import org.apache.log4j.Logger; import org.simantics.objmap.MappingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Accesses the given field of the element. @@ -22,7 +23,7 @@ import org.simantics.objmap.MappingException; */ public class FieldAccessor implements IRangeAccessor { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); Field field; @@ -37,7 +38,7 @@ public class FieldAccessor implements IRangeAccessor { T result = (T)field.get(element); if(LOGGER.isInfoEnabled()) - LOGGER.info(" FieldAccessor.get " + + LOGGER.trace(" FieldAccessor.get " + field.getName() + " -> " + result ); @@ -55,7 +56,7 @@ public class FieldAccessor implements IRangeAccessor { Object currentValue = field.get(element); if(LOGGER.isInfoEnabled()) - LOGGER.info(" FieldAccessor.set " + + LOGGER.trace(" FieldAccessor.set " + field.getName() + " " + currentValue + " -> " + value ); diff --git a/bundles/org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java b/bundles/org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java index 7cbfbb3d..21fab23a 100644 --- a/bundles/org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java +++ b/bundles/org.simantics.objmap/src/org/simantics/objmap/schema/SimpleLinkType.java @@ -13,7 +13,6 @@ package org.simantics.objmap.schema; import java.util.ArrayList; -import org.apache.log4j.Logger; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.WriteGraph; @@ -24,6 +23,8 @@ import org.simantics.objmap.IFunction; import org.simantics.objmap.ILinkType; import org.simantics.objmap.IMappingRule; import org.simantics.objmap.MappingException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A link type that is associated with single domain and range type (class). @@ -33,7 +34,7 @@ import org.simantics.objmap.MappingException; */ public class SimpleLinkType implements ILinkType { - static Logger LOGGER = Logger.getLogger("org.simantics.objmap"); + static Logger LOGGER = LoggerFactory.getLogger("org.simantics.objmap"); public Resource domainType; public Class rangeType; @@ -63,7 +64,7 @@ public class SimpleLinkType implements ILinkType { throws MappingException { try { if(LOGGER.isInfoEnabled()) - LOGGER.info("SimpleLinkType.createDomainElement " + + LOGGER.trace("SimpleLinkType.createDomainElement " + rangeElement.toString() ); Resource result = g.newResource(); @@ -79,7 +80,7 @@ public class SimpleLinkType implements ILinkType { try { if(LOGGER.isInfoEnabled()) try { - LOGGER.info("SimpleLinkType.createRangeElement " + + LOGGER.trace("SimpleLinkType.createRangeElement " + NameUtils.getSafeName(g, domainElement) ); } catch(DatabaseException e) { @@ -98,7 +99,7 @@ public class SimpleLinkType implements ILinkType { throws MappingException { if(LOGGER.isInfoEnabled()) try { - LOGGER.info("SimpleLinkType.updateDomain " + + LOGGER.trace("SimpleLinkType.updateDomain " + NameUtils.getSafeName(g, domainElement) + " " + rangeElement.toString() ); @@ -117,7 +118,7 @@ public class SimpleLinkType implements ILinkType { throws MappingException { if(LOGGER.isInfoEnabled()) try { - LOGGER.info("SimpleLinkType.updateRange " + + LOGGER.trace("SimpleLinkType.updateRange " + NameUtils.getSafeName(g, domainElement) + " " + rangeElement.toString() ); diff --git a/bundles/org.simantics.sysdyn.ui/META-INF/MANIFEST.MF b/bundles/org.simantics.sysdyn.ui/META-INF/MANIFEST.MF index cb3cfaca..9aef9978 100644 --- a/bundles/org.simantics.sysdyn.ui/META-INF/MANIFEST.MF +++ b/bundles/org.simantics.sysdyn.ui/META-INF/MANIFEST.MF @@ -17,7 +17,6 @@ Require-Bundle: org.simantics.layer0.utils;bundle-version="0.6.2", org.eclipse.ui.editors;bundle-version="3.5.0", org.jfree.jchart;bundle-version="1.5.0", org.simantics.modelica;bundle-version="1.0.0", - org.apache.log4j;bundle-version="1.2.15", org.eclipse.ui.console;bundle-version="3.4.0", org.simantics.browsing.ui.graph;bundle-version="1.1.0", org.simantics.browsing.ui.swt;bundle-version="1.1.0", diff --git a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/Activator.java b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/Activator.java index 5e1333d7..45e9d6a4 100644 --- a/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/Activator.java +++ b/bundles/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/Activator.java @@ -13,11 +13,6 @@ package org.simantics.sysdyn.ui; import java.net.URL; -import org.apache.log4j.BasicConfigurator; -import org.apache.log4j.ConsoleAppender; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; -import org.apache.log4j.SimpleLayout; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageRegistry; import org.eclipse.jface.resource.JFaceResources; @@ -50,13 +45,8 @@ public class Activator extends AbstractUIPlugin { @Override public void start(BundleContext context) throws Exception { super.start(context); - ConsoleAppender appender = - new ConsoleAppender(new SimpleLayout()); - BasicConfigurator.configure(appender); - Logger.getRootLogger().setLevel(Level.WARN); plugin = this; - - + Bundle bundle = context.getBundle(); FATAL_SVG_TEXT = FileUtils.getContents(bundle.getResource("icons/fatal.svg")); -- 2.47.1