diff options
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java | 8 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java index 97ffaf0d62f..95fbdbced5f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java @@ -19,6 +19,9 @@ */ package org.sonar.batch.bootstrapper; +import org.sonar.core.profiling.Profiling.Level; + +import org.sonar.core.profiling.Profiling; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Maps; import org.apache.commons.lang.StringUtils; @@ -68,8 +71,9 @@ public final class LoggingConfiguration { } public LoggingConfiguration setProperties(Map<String, String> properties) { - setShowSql("true".equals(properties.get("sonar.showSql"))); - setShowSqlResults("true".equals(properties.get("sonar.showSqlResults"))); + Profiling.Level profilingLevel = Profiling.Level.fromConfigString(properties.get("sonar.log.profilingLevel")); + setShowSql(profilingLevel == Level.FULL); + setShowSqlResults(profilingLevel == Level.FULL); setVerbose("true".equals(properties.get("sonar.verbose"))); return this; } diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java index 1f818ea82e9..79a59642250 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java @@ -85,11 +85,15 @@ public class LoggingConfigurationTest { assertThat(LoggingConfiguration.create(null).setProperties(properties) .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_SQL_DEFAULT); - properties.put("sonar.showSql", "true"); + properties.put("sonar.log.profilingLevel", "FULL"); assertThat(LoggingConfiguration.create(null).setProperties(properties) .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_SQL_VERBOSE); - properties.put("sonar.showSql", "false"); + properties.put("sonar.log.profilingLevel", "BASIC"); + assertThat(LoggingConfiguration.create(null).setProperties(properties) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_SQL_DEFAULT); + + properties.put("sonar.log.profilingLevel", "NONE"); assertThat(LoggingConfiguration.create(null).setProperties(properties) .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL)).isEqualTo(LoggingConfiguration.LEVEL_SQL_DEFAULT); } |