diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-10-01 13:51:49 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-10-01 13:51:49 +0200 |
commit | d825f8703421eca5e22463c137f83884d8e7ad80 (patch) | |
tree | 5085ec5055968460ea8efb68f3eaf2627c92c13a /sonar-server | |
parent | 0948e149236c52de51862a759980853e16753f9b (diff) | |
download | sonarqube-d825f8703421eca5e22463c137f83884d8e7ad80.tar.gz sonarqube-d825f8703421eca5e22463c137f83884d8e7ad80.zip |
Do not use deprecated Logs.INFO in startup tasks
Diffstat (limited to 'sonar-server')
4 files changed, 14 insertions, 9 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewDashboards.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewDashboards.java index ea1cd7f29df..ed5683cbe64 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewDashboards.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewDashboards.java @@ -21,6 +21,7 @@ package org.sonar.server.startup; import com.google.common.collect.Lists; import com.google.common.collect.Ordering; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.utils.TimeProfiler; import org.sonar.api.web.Dashboard; @@ -38,6 +39,8 @@ import java.util.Map.Entry; * @since 2.13 */ public final class RegisterNewDashboards { + private static final Logger LOG = LoggerFactory.getLogger(RegisterNewDashboards.class); + static final String DEFAULT_DASHBOARD_NAME = "Dashboard"; private final List<DashboardTemplate> dashboardTemplates; @@ -54,7 +57,7 @@ public final class RegisterNewDashboards { } public void start() { - TimeProfiler profiler = new TimeProfiler().start("Register dashboards"); + TimeProfiler profiler = new TimeProfiler(LOG).start("Register dashboards"); List<DashboardDto> registeredDashboards = Lists.newArrayList(); for (DashboardTemplate template : dashboardTemplates) { @@ -81,12 +84,11 @@ public final class RegisterNewDashboards { } private void activate(DashboardDto dashboardDto, int index) { + LOG.info("Register dashboard: " + dashboardDto.getName()); ActiveDashboardDto activeDashboardDto = new ActiveDashboardDto() .setDashboardId(dashboardDto.getId()) .setOrderIndex(index); activeDashboardDao.insert(activeDashboardDto); - - LoggerFactory.getLogger(getClass()).info("New dashboard '" + dashboardDto.getName() + "' registered"); } protected DashboardDto register(String name, Dashboard dashboard) { diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewFilters.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewFilters.java index 1a9c7b1d233..864b3e01cc3 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewFilters.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewFilters.java @@ -53,7 +53,7 @@ public final class RegisterNewFilters { } public void start() { - TimeProfiler profiler = new TimeProfiler(LoggerFactory.getLogger(getClass())).start("Register filters"); + TimeProfiler profiler = new TimeProfiler(LOG).start("Register filters"); for (FilterTemplate template : filterTemplates) { if (shouldRegister(template.getName())) { @@ -72,9 +72,9 @@ public final class RegisterNewFilters { protected FilterDto register(String name, Filter filter) { FilterDto dto = null; if (filterDao.findFilter(name) == null) { + LOG.info("Register filter: " + name); dto = createDtoFromExtension(name, filter); filterDao.insert(dto); - LOG.info("New filter '" + dto.getName() + "' registered"); } // and save the fact that is has now already been loaded loadedTemplateDao.insert(new LoadedTemplateDto(name, LoadedTemplateDto.FILTER_TYPE)); diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewProfiles.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewProfiles.java index 5c2f5a15480..8853c88f5b3 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewProfiles.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterNewProfiles.java @@ -75,7 +75,7 @@ public class RegisterNewProfiles { } public void start() { - TimeProfiler profiler = new TimeProfiler().start("Register Quality Profiles"); + TimeProfiler profiler = new TimeProfiler(LOGGER).start("Register Quality Profiles"); session = sessionFactory.getSession(); ListMultimap<String, RulesProfile> profilesByLanguage = loadDefinitions(); for (String language : profilesByLanguage.keySet()) { @@ -99,7 +99,7 @@ public class RegisterNewProfiles { String propertyKey = "sonar.profile." + language; if (settings.getString(propertyKey) == null) { String defaultProfileName = defaultProfileName(profiles); - LOGGER.info("Set default profile for " + language + ": " + defaultProfileName); + LOGGER.info("Set default " + language + " profile: " + defaultProfileName); settings.saveProperty(propertyKey, defaultProfileName); } } @@ -122,6 +122,7 @@ public class RegisterNewProfiles { } private void register(String language, String name, Collection<RulesProfile> profiles) { + LOGGER.info("Register " + language + " profile: " + name); clean(language, name); insert(language, name, profiles); loadedTemplateDao.insert(new LoadedTemplateDto(templateKey(language, name), LoadedTemplateDto.QUALITY_PROFILE_TYPE)); diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RegisterQualityModels.java b/sonar-server/src/main/java/org/sonar/server/startup/RegisterQualityModels.java index 8cd11babaf1..5f76dbd9840 100644 --- a/sonar-server/src/main/java/org/sonar/server/startup/RegisterQualityModels.java +++ b/sonar-server/src/main/java/org/sonar/server/startup/RegisterQualityModels.java @@ -19,11 +19,13 @@ */ package org.sonar.server.startup; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.utils.TimeProfiler; import org.sonar.server.qualitymodel.ModelManager; public final class RegisterQualityModels { - + private static final Logger LOG = LoggerFactory.getLogger(RegisterQualityModels.class); private final ModelManager manager; /** @@ -34,7 +36,7 @@ public final class RegisterQualityModels { } public void start() { - TimeProfiler profiler = new TimeProfiler().start("Register quality models"); + TimeProfiler profiler = new TimeProfiler(LOG).start("Register Quality Models"); manager.registerDefinitions(); profiler.stop(); } |