diff options
author | lgoubet | 2022-03-22 09:21:40 +0000 |
---|---|---|
committer | lgoubet | 2022-03-22 10:47:06 +0000 |
commit | 70d1945b4b5e45d0e8bad09a69df841ae9122f65 (patch) | |
tree | 796867b779f255107931d472ecc20736e9be7c46 | |
parent | 79dc341a05e33fe9f9d2fe52ce146aa756d04f71 (diff) | |
download | org.eclipse.emf.compare-70d1945b4b5e45d0e8bad09a69df841ae9122f65.tar.gz org.eclipse.emf.compare-70d1945b4b5e45d0e8bad09a69df841ae9122f65.tar.xz org.eclipse.emf.compare-70d1945b4b5e45d0e8bad09a69df841ae9122f65.zip |
Remove logging from the EMF Compare core
Most of these logs were only start/end information for comparison
phases. This depends on an external logger as the core is standalone.
Log4J 2 does not seem viable for eclipse as it requires an external
configuration file instead of being configurable through API, and we
can't have a global eclipse configuration just for compare. We wish to
remove the dependency towards Log4j 1.
Bug: 578953
Change-Id: Ib421d2f9487f84d8867f936faa0fc068e72e75d3
11 files changed, 1 insertions, 307 deletions
diff --git a/plugins/org.eclipse.emf.compare/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.compare/META-INF/MANIFEST.MF index 54fe0226d..87150bc14 100644 --- a/plugins/org.eclipse.emf.compare/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.compare/META-INF/MANIFEST.MF @@ -43,5 +43,4 @@ Bundle-ActivationPolicy: lazy Import-Package: com.google.common.base;version="[27.0.0,30.2.0)", com.google.common.cache;version="[27.0.0,30.2.0)", com.google.common.collect;version="[27.0.0,30.2.0)", - com.google.common.eventbus;version="[27.0.0,30.2.0)", - org.apache.log4j;version="[1.2.15,2.0.0)" + com.google.common.eventbus;version="[27.0.0,30.2.0)" diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/EMFCompare.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/EMFCompare.java index d75ffc9f1..8512f6f44 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/EMFCompare.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/EMFCompare.java @@ -16,14 +16,12 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.util.Iterator; import java.util.List; -import org.apache.log4j.Logger; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.BasicMonitor; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.DiagnosticChain; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.compare.conflict.IConflictDetector; import org.eclipse.emf.compare.conflict.MatchBasedConflictDetector; @@ -70,15 +68,6 @@ public class EMFCompare { */ public static final String DIAGNOSTIC_SOURCE = "org.eclipse.emf.compare"; //$NON-NLS-1$ - /** Constant for logging. */ - private static final String START = " - START"; //$NON-NLS-1$ - - /** Constant for logging. */ - private static final String FINISH = " - FINISH"; //$NON-NLS-1$ - - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(EMFCompare.class); - /** The registry we'll use to create a match engine for this comparison. */ private final IMatchEngine.Factory.Registry matchEngineFactoryRegistry; @@ -204,19 +193,9 @@ public class EMFCompare { checkNotNull(scope); checkNotNull(monitor); - // Used to compute the time spent in the method - long startTime = System.currentTimeMillis(); - - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - START"); //$NON-NLS-1$ - } - Comparison comparison = null; try { Monitor subMonitor = new SafeSubMonitor(monitor); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: MATCH"); //$NON-NLS-1$ - } comparison = matchEngineFactoryRegistry.getHighestRankingMatchEngineFactory(scope) .getMatchEngine().match(scope, subMonitor); @@ -226,62 +205,30 @@ public class EMFCompare { List<IPostProcessor> postProcessors = postProcessorDescriptorRegistry.getPostProcessors(scope); // CHECKSTYLE:OFF Yes, I want to have ifs here and no constant for "post-processor". - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: POST-MATCH with " + postProcessors.size() //$NON-NLS-1$ - + " post-processors"); //$NON-NLS-1$ - } postMatch(comparison, postProcessors, subMonitor); monitor.worked(1); if (!hasToStop(comparison, monitor)) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: DIFF"); //$NON-NLS-1$ - } diffEngine.diff(comparison, subMonitor); monitor.worked(1); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: POST-DIFF with " //$NON-NLS-1$ - + postProcessors.size() + " post-processors"); //$NON-NLS-1$ - } postDiff(comparison, postProcessors, subMonitor); monitor.worked(1); if (!hasToStop(comparison, monitor)) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: REQUIREMENTS"); //$NON-NLS-1$ - } reqEngine.computeRequirements(comparison, subMonitor); monitor.worked(1); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: POST-REQUIREMENTS with " //$NON-NLS-1$ - + postProcessors.size() + " post-processors"); //$NON-NLS-1$ - } postRequirements(comparison, postProcessors, subMonitor); monitor.worked(1); if (!hasToStop(comparison, monitor)) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: EQUIVALENCES"); //$NON-NLS-1$ - } equiEngine.computeEquivalences(comparison, subMonitor); monitor.worked(1); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: POST-EQUIVALENCES with " //$NON-NLS-1$ - + postProcessors.size() + " post-processors"); //$NON-NLS-1$ - } postEquivalences(comparison, postProcessors, subMonitor); monitor.worked(1); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: CONFLICT"); //$NON-NLS-1$ - } detectConflicts(comparison, postProcessors, subMonitor); monitor.worked(1); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - starting step: POST-COMPARISON with " //$NON-NLS-1$ - + postProcessors.size() + " post-processors"); //$NON-NLS-1$ - } // CHECKSTYLE:ON postComparison(comparison, postProcessors, subMonitor); monitor.worked(1); @@ -289,9 +236,6 @@ public class EMFCompare { } } } catch (ComparisonCanceledException e) { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("compare() - Comparison has been canceled"); //$NON-NLS-1$ - } if (comparison == null) { comparison = new ComparisonSpec(); } @@ -307,10 +251,6 @@ public class EMFCompare { monitor.done(); } - if (LOGGER.isInfoEnabled()) { - logEndOfComparison(comparison, startTime); - } - // Add scope to the comparison's adapters to make it available throughout the framework if (scope instanceof Adapter) { comparison.eAdapters().add((Adapter)scope); @@ -353,32 +293,6 @@ public class EMFCompare { } /** - * Log useful informations at the end of the comparison process. - * - * @param comparison - * The comparison - * @param start - * The time when the method start - */ - private void logEndOfComparison(Comparison comparison, long start) { - long duration = System.currentTimeMillis() - start; - int diffQuantity = comparison.getDifferences().size(); - int conflictQuantity = comparison.getConflicts().size(); - int matchQuantity = 0; - EList<Match> matches = comparison.getMatches(); - for (Match match : matches) { - matchQuantity++; - Iterator<Match> subMatchIterator = match.getAllSubmatches().iterator(); - while (subMatchIterator.hasNext()) { - matchQuantity++; - subMatchIterator.next(); - } - } - LOGGER.info("compare() - FINISH - " + matchQuantity + " matches, " + diffQuantity + " diffs and " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - + conflictQuantity + " conflicts found in " + duration + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** * Launches the conflict detection engine, if any has been given and if the comparison is three way. * * @param comparison @@ -411,15 +325,7 @@ public class EMFCompare { Iterator<IPostProcessor> processorsIterator = postProcessors.iterator(); while (!hasToStop(comparison, monitor) && processorsIterator.hasNext()) { final IPostProcessor iPostProcessor = processorsIterator.next(); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postMatch with post-processor: " //$NON-NLS-1$ - + iPostProcessor.getClass().getName() + START); - } iPostProcessor.postMatch(comparison, monitor); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postMatch with post-processor: " //$NON-NLS-1$ - + iPostProcessor.getClass().getName() + FINISH); - } } } @@ -438,15 +344,7 @@ public class EMFCompare { Iterator<IPostProcessor> processorsIterator = postProcessors.iterator(); while (!hasToStop(comparison, monitor) && processorsIterator.hasNext()) { final IPostProcessor iPostProcessor = processorsIterator.next(); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postDiff with post-processor: " + iPostProcessor.getClass().getName() //$NON-NLS-1$ - + START); - } iPostProcessor.postDiff(comparison, monitor); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postDiff with post-processor: " + iPostProcessor.getClass().getName() //$NON-NLS-1$ - + FINISH); - } } } @@ -465,15 +363,7 @@ public class EMFCompare { Iterator<IPostProcessor> processorsIterator = postProcessors.iterator(); while (!hasToStop(comparison, monitor) && processorsIterator.hasNext()) { final IPostProcessor iPostProcessor = processorsIterator.next(); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postRequirements with post-processor: " //$NON-NLS-1$ - + iPostProcessor.getClass().getName() + START); - } iPostProcessor.postRequirements(comparison, monitor); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postRequirements with post-processor: " //$NON-NLS-1$ - + iPostProcessor.getClass().getName() + FINISH); - } } } @@ -492,15 +382,7 @@ public class EMFCompare { Iterator<IPostProcessor> processorsIterator = postProcessors.iterator(); while (!hasToStop(comparison, monitor) && processorsIterator.hasNext()) { final IPostProcessor iPostProcessor = processorsIterator.next(); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postEquivalences with post-processor: " //$NON-NLS-1$ - + iPostProcessor.getClass().getName() + START); - } iPostProcessor.postEquivalences(comparison, monitor); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postEquivalences with post-processor: " //$NON-NLS-1$ - + iPostProcessor.getClass().getName() + FINISH); - } } } @@ -519,15 +401,7 @@ public class EMFCompare { Iterator<IPostProcessor> processorsIterator = postProcessors.iterator(); while (!hasToStop(comparison, monitor) && processorsIterator.hasNext()) { final IPostProcessor iPostProcessor = processorsIterator.next(); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postConflicts with post-processor: " //$NON-NLS-1$ - + iPostProcessor.getClass().getName() + START); - } iPostProcessor.postConflicts(comparison, monitor); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postConflicts with post-processor: " //$NON-NLS-1$ - + iPostProcessor.getClass().getName() + FINISH); - } } } @@ -547,19 +421,11 @@ public class EMFCompare { int postProcessorIndex = 1; while (!hasToStop(comparison, monitor) && processorsIterator.hasNext()) { final IPostProcessor postProcessor = processorsIterator.next(); - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postComparison with post-processor: " //$NON-NLS-1$ - + postProcessor.getClass().getName() + START); - } monitor.subTask(EMFCompareMessages.getString("PostComparison.monitor.postprocessor", //$NON-NLS-1$ postProcessor.getClass().getSimpleName(), String.valueOf(postProcessorIndex), String.valueOf(postProcessors.size()))); postProcessor.postComparison(comparison, monitor); postProcessorIndex++; - if (LOGGER.isInfoEnabled()) { - LOGGER.info("postComparison with post-processor: " //$NON-NLS-1$ - + postProcessor.getClass().getName() + FINISH); - } } } diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java index 6430febc7..2ed2a52f9 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/DefaultConflictDetector.java @@ -24,7 +24,6 @@ import java.util.function.Predicate; import java.util.stream.Stream; import java.util.stream.StreamSupport; -import org.apache.log4j.Logger; import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.compare.AttributeChange; import org.eclipse.emf.compare.CompareFactory; @@ -69,9 +68,6 @@ import org.eclipse.emf.ecore.util.FeatureMap; */ public class DefaultConflictDetector implements IConflictDetector { - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(DefaultConflictDetector.class); - /** * {@inheritDoc} * @@ -79,10 +75,6 @@ public class DefaultConflictDetector implements IConflictDetector { * org.eclipse.emf.common.util.Monitor) */ public void detect(Comparison comparison, Monitor monitor) { - long start = System.currentTimeMillis(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("detect conflicts - START"); //$NON-NLS-1$ - } final List<Diff> differences = comparison.getDifferences(); final int diffCount = differences.size(); @@ -99,11 +91,6 @@ public class DefaultConflictDetector implements IConflictDetector { Stream<Diff> conflictCandidates = differences.stream().filter(possiblyConflictingWith(diff)); checkConflict(comparison, diff, conflictCandidates::iterator); } - - if (LOGGER.isInfoEnabled()) { - LOGGER.info(String.format("detect conflicts - END - Took %d ms", Long.valueOf(System //$NON-NLS-1$ - .currentTimeMillis() - start))); - } } /** diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/MatchBasedConflictDetector.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/MatchBasedConflictDetector.java index 2a03ffae9..f31e26f25 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/MatchBasedConflictDetector.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/conflict/MatchBasedConflictDetector.java @@ -12,7 +12,6 @@ package org.eclipse.emf.compare.conflict; import java.util.List; -import org.apache.log4j.Logger; import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.compare.Comparison; import org.eclipse.emf.compare.ComparisonCanceledException; @@ -38,9 +37,6 @@ import org.eclipse.emf.ecore.EObject; */ public class MatchBasedConflictDetector implements IConflictDetector { - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(MatchBasedConflictDetector.class); - /** * {@inheritDoc} * @@ -48,10 +44,6 @@ public class MatchBasedConflictDetector implements IConflictDetector { * org.eclipse.emf.common.util.Monitor) */ public void detect(Comparison comparison, Monitor monitor) { - long start = System.currentTimeMillis(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("detect conflicts - START"); //$NON-NLS-1$ - } final List<Diff> differences = comparison.getDifferences(); final int diffCount = differences.size(); @@ -68,10 +60,5 @@ public class MatchBasedConflictDetector implements IConflictDetector { AbstractConflictSearch<? extends Diff> search = conflictSearchFactory.doSwitch(diff); search.detectConflicts(); } - - if (LOGGER.isInfoEnabled()) { - LOGGER.info(String.format("detect conflicts - END - Took %d ms", Long.valueOf(System //$NON-NLS-1$ - .currentTimeMillis() - start))); - } } } diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/diff/DefaultDiffEngine.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/diff/DefaultDiffEngine.java index 9b95b5193..a4b73aae8 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/diff/DefaultDiffEngine.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/diff/DefaultDiffEngine.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import org.apache.log4j.Logger; import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.compare.Comparison; import org.eclipse.emf.compare.ComparisonCanceledException; @@ -61,9 +60,6 @@ public class DefaultDiffEngine implements IDiffEngine { */ protected static final Object UNMATCHED_VALUE = new Object(); - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(DefaultDiffEngine.class); - /** * The diff processor that will be used by this engine. Should be passed by the constructor and accessed * by {@link #getDiffProcessor()}. @@ -120,18 +116,10 @@ public class DefaultDiffEngine implements IDiffEngine { * org.eclipse.emf.common.util.Monitor) */ public void diff(Comparison comparison, Monitor monitor) { - long start = System.currentTimeMillis(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("detect differences - START")); //$NON-NLS-1$ - } monitor.subTask(EMFCompareMessages.getString("DefaultDiffEngine.monitor.diff")); //$NON-NLS-1$ for (Match rootMatch : comparison.getMatches()) { checkForDifferences(rootMatch, monitor); } - if (LOGGER.isInfoEnabled()) { - LOGGER.info(String.format("detect differences - END - Took %d ms", Long.valueOf(System //$NON-NLS-1$ - .currentTimeMillis() - start))); - } } /** diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/equi/DefaultEquiEngine.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/equi/DefaultEquiEngine.java index 87ac0b681..d880940e8 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/equi/DefaultEquiEngine.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/equi/DefaultEquiEngine.java @@ -15,7 +15,6 @@ import java.util.LinkedHashSet; import java.util.Set; import java.util.function.Predicate; -import org.apache.log4j.Logger; import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.compare.CompareFactory; import org.eclipse.emf.compare.Comparison; @@ -46,9 +45,6 @@ import org.eclipse.emf.ecore.util.FeatureMap; */ public class DefaultEquiEngine implements IEquiEngine { - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(DefaultEquiEngine.class); - /** * {@inheritDoc} * @@ -56,10 +52,6 @@ public class DefaultEquiEngine implements IEquiEngine { * org.eclipse.emf.common.util.Monitor) */ public void computeEquivalences(Comparison comparison, Monitor monitor) { - long start = System.currentTimeMillis(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("detect equivalences - START")); //$NON-NLS-1$ - } monitor.subTask(EMFCompareMessages.getString("DefaultEquiEngine.monitor.eq")); //$NON-NLS-1$ for (Diff difference : comparison.getDifferences()) { if (monitor.isCanceled()) { @@ -67,10 +59,6 @@ public class DefaultEquiEngine implements IEquiEngine { } checkForEquivalences(comparison, difference); } - if (LOGGER.isInfoEnabled()) { - LOGGER.info(String.format("detect equivalences - END - Took %d ms", Long.valueOf(System //$NON-NLS-1$ - .currentTimeMillis() - start))); - } } /** diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/match/DefaultMatchEngine.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/match/DefaultMatchEngine.java index 65f660d78..29c78dd5d 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/match/DefaultMatchEngine.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/match/DefaultMatchEngine.java @@ -21,7 +21,6 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; -import org.apache.log4j.Logger; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.common.util.URI; @@ -63,9 +62,6 @@ public class DefaultMatchEngine implements IMatchEngine { */ public static final int DEFAULT_EOBJECT_URI_CACHE_MAX_SIZE = 1024; - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(DefaultMatchEngine.class); - /** The delegate {@link IEObjectMatcher matcher} that will actually pair EObjects together. */ private final IEObjectMatcher eObjectMatcher; @@ -113,10 +109,6 @@ public class DefaultMatchEngine implements IMatchEngine { * org.eclipse.emf.common.util.Monitor) */ public Comparison match(IComparisonScope scope, Monitor monitor) { - long start = System.currentTimeMillis(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("detect matches - START")); //$NON-NLS-1$ - } Comparison comparison = comparisonFactory.createComparison(); final Notifier left = scope.getLeft(); @@ -127,10 +119,6 @@ public class DefaultMatchEngine implements IMatchEngine { match(comparison, scope, left, right, origin, monitor); - if (LOGGER.isInfoEnabled()) { - LOGGER.info(String.format("detect matches - END - Took %d ms", Long.valueOf(System //$NON-NLS-1$ - .currentTimeMillis() - start))); - } return comparison; } diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/AbstractMerger.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/AbstractMerger.java index 42914a8f4..9f7ffc37c 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/AbstractMerger.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/AbstractMerger.java @@ -45,7 +45,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.log4j.Logger; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.compare.Comparison; @@ -80,9 +79,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe /** The key of the merge option that allows to the mergers to consider sub-diffs of a diff as a whole. */ public static final String SUB_DIFF_AWARE_OPTION = "subDiffAwareOption"; //$NON-NLS-1$ - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(AbstractMerger.class); - /** A predicate for diffs with an unresolved state. */ private static final Predicate<? super Diff> HAS_UNRESOLVED_STATE = EMFComparePredicates .hasState(UNRESOLVED); @@ -206,8 +202,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe * @since 3.2 */ public Set<Diff> getDirectMergeDependencies(Diff diff, boolean mergeRightToLeft) { - long start = System.currentTimeMillis(); - final Set<Diff> dependencies = new LazyLinkedHashSet<Diff>(); if (isAccepting(diff, mergeRightToLeft)) { dependencies.addAll(diff.getRequires()); @@ -224,14 +218,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe } } - if (LOGGER.isDebugEnabled()) { - Long duration = new Long(System.currentTimeMillis() - start); - String log = String.format( - "getDirectMergeDependencies(Diff, boolean) - %d dependencies found in %d ms for diff %d", //$NON-NLS-1$ - new Integer(dependencies.size()), duration, new Integer(diff.hashCode())); - LOGGER.debug(log); - } - return dependencies; } @@ -241,20 +227,10 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe * @since 3.2 */ public Set<Diff> getDirectResultingMerges(Diff target, boolean mergeRightToLeft) { - long start = System.currentTimeMillis(); - final Set<Diff> resulting = new LazyLinkedHashSet<Diff>(); resulting.addAll(getImpliedMerges(target, mergeRightToLeft)); resulting.addAll(getLogicallyResultingMerges(target, mergeRightToLeft)); - if (LOGGER.isDebugEnabled()) { - Long duration = new Long(System.currentTimeMillis() - start); - String log = String.format( - "getDirectResultingMerges(Diff, boolean) - %d resulting merges found in %d ms for diff %d", //$NON-NLS-1$ - new Integer(resulting.size()), duration, new Integer(target.hashCode())); - LOGGER.debug(log); - } - return resulting; } @@ -358,8 +334,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe * @since 3.2 */ public Set<Diff> getDirectResultingRejections(Diff target, boolean rightToLeft) { - long start = System.currentTimeMillis(); - final Set<Diff> directlyImpliedRejections = new LazyLinkedHashSet<Diff>(); final Conflict conflict = target.getConflict(); if (conflict != null && conflict.getKind() == ConflictKind.REAL) { @@ -369,14 +343,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe } } - if (LOGGER.isDebugEnabled()) { - Long duration = new Long(System.currentTimeMillis() - start); - String log = String.format( - "getDirectResultingMerges(Diff, boolean) - %d implied rejections found in %d ms for diff %d", //$NON-NLS-1$ - new Integer(directlyImpliedRejections.size()), duration, new Integer(target.hashCode())); - LOGGER.debug(log); - } - return directlyImpliedRejections; } @@ -649,8 +615,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe * @since 3.5 */ protected Set<Diff> getLogicallyResultingMerges(Diff diff, boolean mergeRightToLeft) { - long start = System.currentTimeMillis(); - final Set<Diff> resulting = new LazyLinkedHashSet<Diff>(); // we need to add the implication side that actually needs merging @@ -670,14 +634,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe Iterables.addAll(resulting, directSubDiffs); } - if (LOGGER.isDebugEnabled()) { - Long duration = new Long(System.currentTimeMillis() - start); - String log = String.format( - "getLogicallyResultingMerges(Diff, boolean) - %d merges found in %d ms for diff %d", //$NON-NLS-1$ - new Integer(resulting.size()), duration, new Integer(diff.hashCode())); - LOGGER.debug(log); - } - return resulting; } @@ -695,7 +651,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe * @since 3.5 */ protected Set<Diff> getImpliedMerges(Diff target, boolean mergeRightToLeft) { - long start = System.currentTimeMillis(); final Set<Diff> impliedMerges = new LazyLinkedHashSet<Diff>(); if (isAccepting(target, mergeRightToLeft)) { @@ -744,13 +699,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe } } - if (LOGGER.isDebugEnabled()) { - Long duration = new Long(System.currentTimeMillis() - start); - String log = String.format( - "getImpliedMerges(Diff, boolean) - %d implied merges found in %d ms for diff %d", //$NON-NLS-1$ - new Integer(impliedMerges.size()), duration, new Integer(target.hashCode())); - LOGGER.debug(log); - } return impliedMerges; } @@ -771,8 +719,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe return; } - long start = System.currentTimeMillis(); - // Change the diff's state before we actually merge it : this allows us to avoid requirement cycles. target.setState(MERGING); @@ -799,13 +745,6 @@ public abstract class AbstractMerger implements IMerger2, IMergeOptionAware, IMe reject(target, rightToLeft); target.setState(DISCARDED); } - - if (LOGGER.isDebugEnabled()) { - long duration = System.currentTimeMillis() - start; - LOGGER.debug("copyDiff(Diff, Monitor, Boolean) - diff " + target.hashCode() //$NON-NLS-1$ - + " merged (rightToLeft: " + rightToLeft + ") in " //$NON-NLS-1$ //$NON-NLS-2$ - + duration + "ms"); //$NON-NLS-1$ - } } /** diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/BatchMerger.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/BatchMerger.java index cde9540b5..81fd3bf5e 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/BatchMerger.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/BatchMerger.java @@ -16,7 +16,6 @@ import static com.google.common.base.Predicates.alwaysTrue; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; -import org.apache.log4j.Logger; import org.eclipse.emf.common.util.Monitor; import org.eclipse.emf.compare.Diff; @@ -29,9 +28,6 @@ import org.eclipse.emf.compare.Diff; */ public class BatchMerger implements IBatchMerger { - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(BatchMerger.class); - /** The registry from which we'll retrieve our mergers. */ private final IMerger.Registry2 registry; @@ -134,26 +130,13 @@ public class BatchMerger implements IBatchMerger { * org.eclipse.emf.common.util.Monitor) */ public void copyAllLeftToRight(Iterable<? extends Diff> differences, Monitor monitor) { - long start = 0; - if (LOGGER.isDebugEnabled()) { - start = System.currentTimeMillis(); - LOGGER.debug("copyAllLeftToRight(differences, monitor) - Start"); //$NON-NLS-1$ - } ComputeDiffsToMerge computer = new ComputeDiffsToMerge(false, relationshipComputer); for (Diff toMerge : computer.getAllDiffsToMerge(Iterables.filter(differences, filter))) { if (!AbstractMerger.isInTerminalState(toMerge)) { final IMerger merger = registry.getHighestRankingMerger(toMerge); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("copyAllLeftToRight - Selected merger: " //$NON-NLS-1$ - + merger.getClass().getSimpleName()); - } merger.copyLeftToRight(toMerge, monitor); } } - if (LOGGER.isDebugEnabled()) { - long duration = System.currentTimeMillis() - start; - LOGGER.debug("copyAllLeftToRight(differences, monitor) - Stop - Time spent: " + duration + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ - } } /** @@ -163,25 +146,12 @@ public class BatchMerger implements IBatchMerger { * org.eclipse.emf.common.util.Monitor) */ public void copyAllRightToLeft(Iterable<? extends Diff> differences, Monitor monitor) { - long start = 0; - if (LOGGER.isDebugEnabled()) { - start = System.currentTimeMillis(); - LOGGER.debug("copyAllRightToLeft(differences, monitor) - Start"); //$NON-NLS-1$ - } ComputeDiffsToMerge computer = new ComputeDiffsToMerge(true, relationshipComputer); for (Diff toMerge : computer.getAllDiffsToMerge(Iterables.filter(differences, filter))) { if (!AbstractMerger.isInTerminalState(toMerge)) { final IMerger merger = registry.getHighestRankingMerger(toMerge); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("copyAllLeftToRight - Selected merger: " //$NON-NLS-1$ - + merger.getClass().getSimpleName()); - } merger.copyRightToLeft(toMerge, monitor); } } - if (LOGGER.isDebugEnabled()) { - long duration = System.currentTimeMillis() - start; - LOGGER.debug("copyAllRightToLeft(differences, monitor) - Stop - Time spent: " + duration + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ - } } } diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/ResourceAttachmentChangeMerger.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/ResourceAttachmentChangeMerger.java index 5066828b5..ba7a925fd 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/ResourceAttachmentChangeMerger.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/merge/ResourceAttachmentChangeMerger.java @@ -17,7 +17,6 @@ import static org.eclipse.emf.compare.merge.IMergeCriterion.NONE; import java.util.Collections; import java.util.List; -import org.apache.log4j.Logger; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.compare.Comparison; @@ -42,8 +41,6 @@ import org.eclipse.emf.ecore.xmi.XMIResource; * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a> */ public class ResourceAttachmentChangeMerger extends AbstractMerger { - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(ResourceAttachmentChangeMerger.class); /** * {@inheritDoc} @@ -406,9 +403,6 @@ public class ResourceAttachmentChangeMerger extends AbstractMerger { } else { target = existing; } - if (LOGGER.isInfoEnabled()) { - LOGGER.info("Created resource " + targetURI); //$NON-NLS-1$ - } if (rightToLeft) { soughtMatch.setLeft(target); diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/req/DefaultReqEngine.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/req/DefaultReqEngine.java index 236a5b712..ca25e5339 100644 --- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/req/DefaultReqEngine.java +++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/req/DefaultReqEngine.java @@ -35,7 +35,6 @@ import java.util.concurrent.TimeUnit; import java.util.function.Predicate; import java.util.stream.Stream; -import org.apache.log4j.Logger; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.Monitor; @@ -69,9 +68,6 @@ import org.eclipse.emf.ecore.util.FeatureMap; */ public class DefaultReqEngine implements IReqEngine { - /** The logger. */ - private static final Logger LOGGER = Logger.getLogger(DefaultReqEngine.class); - /** The time before we expire the values in {@link #cachedDifferences} after access, in seconds. */ private static final long CACHE_EXPIRATION_TIME = 30L; @@ -94,10 +90,6 @@ public class DefaultReqEngine implements IReqEngine { * @see org.eclipse.emf.compare.req.IReqEngine#computeRequirements(Comparison, Monitor) */ public void computeRequirements(Comparison comparison, Monitor monitor) { - long start = System.currentTimeMillis(); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(String.format("detect requirements - START")); //$NON-NLS-1$ - } monitor.subTask(EMFCompareMessages.getString("DefaultReqEngine.monitor.req")); //$NON-NLS-1$ for (Diff difference : comparison.getDifferences()) { if (monitor.isCanceled()) { @@ -105,10 +97,6 @@ public class DefaultReqEngine implements IReqEngine { } checkForRequiredDifferences(comparison, difference); } - if (LOGGER.isInfoEnabled()) { - LOGGER.info(String.format("detect requirement - END - Took %d ms", Long.valueOf(System //$NON-NLS-1$ - .currentTimeMillis() - start))); - } } /** |