diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-01-10 16:15:10 +0100 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-01-10 16:15:10 +0100 |
commit | f4322ee342723d15173b31ff6eb59199cf3f4a37 (patch) | |
tree | e4d1d628d0d1a563dad9835aee80d79a71843983 | |
parent | 2647d0f4b78c682da31b5ccfd17107577f9eeecb (diff) | |
download | sonarqube-f4322ee342723d15173b31ff6eb59199cf3f4a37.tar.gz sonarqube-f4322ee342723d15173b31ff6eb59199cf3f4a37.zip |
do not log timemachine messages 'Compare to ...' on views
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java b/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java index 0274fb22637..136ac380cd7 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java +++ b/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java @@ -21,9 +21,14 @@ package org.sonar.batch.components; import com.google.common.collect.Lists; import org.apache.commons.configuration.Configuration; +import org.apache.commons.lang.StringUtils; +import org.slf4j.LoggerFactory; import org.sonar.api.BatchExtension; import org.sonar.api.CoreProperties; +import org.sonar.api.database.model.ResourceModel; import org.sonar.api.database.model.Snapshot; +import org.sonar.api.resources.Resource; +import org.sonar.api.resources.ResourceUtils; import org.sonar.api.utils.Logs; import java.util.Collections; @@ -46,12 +51,22 @@ public class TimeMachineConfiguration implements BatchExtension { for (int index = 1; index <= NUMBER_OF_VARIATION_SNAPSHOTS; index++) { PastSnapshot pastSnapshot = pastSnapshotFinder.find(projectSnapshot, configuration, index); if (pastSnapshot != null) { - Logs.INFO.info(pastSnapshot.toString()); + log(pastSnapshot); projectPastSnapshots.add(pastSnapshot); } } } + private void log(PastSnapshot pastSnapshot) { + String qualifier = pastSnapshot.getProjectSnapshot().getQualifier(); + // hack to avoid too many logs when the views plugin is installed + if (StringUtils.equals(Resource.QUALIFIER_VIEW, qualifier) || StringUtils.equals(Resource.QUALIFIER_SUBVIEW, qualifier)) { + LoggerFactory.getLogger(getClass()).debug(pastSnapshot.toString()); + } else { + Logs.INFO.info(pastSnapshot.toString()); + } + } + public TimeMachineConfiguration(Configuration configuration) { this.configuration = configuration; this.projectPastSnapshots = Collections.emptyList(); |