summaryrefslogtreecommitdiffstats
path: root/sonar-maven-plugin/src/main/java
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-01-12 19:55:58 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-01-12 19:58:08 +0100
commit7be3485cc15dc72c82790d8069b4c301a1aa5862 (patch)
tree46167c203801507e71bbd338d6c99e440300b858 /sonar-maven-plugin/src/main/java
parentb974afb1e66f56fca8d94b6782e04964cb3fde05 (diff)
downloadsonarqube-7be3485cc15dc72c82790d8069b4c301a1aa5862.tar.gz
sonarqube-7be3485cc15dc72c82790d8069b4c301a1aa5862.zip
SONAR-2959 Add the property sonar.showSql
Diffstat (limited to 'sonar-maven-plugin/src/main/java')
-rw-r--r--sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java b/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java
index 7a7ae79d438..9c3a42309ec 100644
--- a/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java
+++ b/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java
@@ -38,7 +38,7 @@ import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.batch.Batch;
import org.sonar.batch.MavenProjectConverter;
import org.sonar.batch.bootstrapper.EnvironmentInformation;
-import org.sonar.core.config.Logback;
+import org.sonar.batch.bootstrapper.LoggingConfiguration;
/**
* @goal sonar
@@ -137,8 +137,13 @@ public final class SonarMojo extends AbstractMojo {
*/
private boolean verbose;
+ /**
+ * @parameter expression="${sonar.showSql}" default-value="false"
+ */
+ private boolean showSql;
+
public void execute() throws MojoExecutionException, MojoFailureException {
- configureLogback();
+ configureLogging();
executeBatch();
}
@@ -147,8 +152,8 @@ public final class SonarMojo extends AbstractMojo {
ProjectReactor reactor = new ProjectReactor(def);
Batch batch = new Batch(reactor, session, getLog(), lifecycleExecutor, pluginManager, artifactFactory,
- localRepository, artifactMetadataSource, artifactCollector, dependencyTreeBuilder,
- projectBuilder, getEnvironmentInformation(), Maven2PluginExecutor.class);
+ localRepository, artifactMetadataSource, artifactCollector, dependencyTreeBuilder,
+ projectBuilder, getEnvironmentInformation(), Maven2PluginExecutor.class);
batch.execute();
}
@@ -157,11 +162,11 @@ public final class SonarMojo extends AbstractMojo {
return new EnvironmentInformation("Maven", mavenVersion);
}
- private void configureLogback() {
- boolean debugMode = (verbose || getLog().isDebugEnabled());
-
- // this system property is required by the logback configuration
- System.setProperty("ROOT_LOGGER_LEVEL", debugMode ? "DEBUG" : "INFO");
- Logback.configure("/org/sonar/maven/logback.xml");
+ private void configureLogging() {
+ LoggingConfiguration.create()
+ .setVerbose(verbose || getLog().isDebugEnabled())
+ .setShowSql(showSql)
+ .setFormat(LoggingConfiguration.FORMAT_MAVEN)
+ .configure();
}
}