diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-01-12 19:55:58 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-01-12 19:58:08 +0100 |
commit | 7be3485cc15dc72c82790d8069b4c301a1aa5862 (patch) | |
tree | 46167c203801507e71bbd338d6c99e440300b858 /sonar-maven3-plugin | |
parent | b974afb1e66f56fca8d94b6782e04964cb3fde05 (diff) | |
download | sonarqube-7be3485cc15dc72c82790d8069b4c301a1aa5862.tar.gz sonarqube-7be3485cc15dc72c82790d8069b4c301a1aa5862.zip |
SONAR-2959 Add the property sonar.showSql
Diffstat (limited to 'sonar-maven3-plugin')
-rw-r--r-- | sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java | 25 | ||||
-rw-r--r-- | sonar-maven3-plugin/src/main/resources/org/sonar/maven3/logback.xml | 42 |
2 files changed, 15 insertions, 52 deletions
diff --git a/sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java b/sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java index 52ceee50f4d..0c3767c98fc 100644 --- a/sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java +++ b/sonar-maven3-plugin/src/main/java/org/sonar/maven3/SonarMojo.java @@ -37,7 +37,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 @@ -130,9 +130,14 @@ 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(); } @@ -141,8 +146,8 @@ public final class SonarMojo extends AbstractMojo { ProjectReactor reactor = new ProjectReactor(def); Batch batch = new Batch(reactor, session, getLog(), lifecycleExecutor, artifactFactory, - localRepository, artifactMetadataSource, artifactCollector, dependencyTreeBuilder, - projectBuilder, getEnvironmentInformation(), Maven3PluginExecutor.class); + localRepository, artifactMetadataSource, artifactCollector, dependencyTreeBuilder, + projectBuilder, getEnvironmentInformation(), Maven3PluginExecutor.class); batch.execute(); } @@ -151,11 +156,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/maven3/logback.xml"); + private void configureLogging() { + LoggingConfiguration.create() + .setVerbose(verbose || getLog().isDebugEnabled()) + .setShowSql(showSql) + .setFormat(LoggingConfiguration.FORMAT_MAVEN) + .configure(); } } diff --git a/sonar-maven3-plugin/src/main/resources/org/sonar/maven3/logback.xml b/sonar-maven3-plugin/src/main/resources/org/sonar/maven3/logback.xml deleted file mode 100644 index 611b3e6ff78..00000000000 --- a/sonar-maven3-plugin/src/main/resources/org/sonar/maven3/logback.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<configuration debug="false"> - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>[%level] [%d{HH:mm:ss.SSS}] %msg%n</pattern> - </encoder> - </appender> - - <logger name="org.hibernate"> - <level value="WARN"/> - </logger> - - <!-- set DEBUG to activate SQL logs. NOT RECOMMENDED --> - <logger name="org.hibernate.SQL"> - <level value="ERROR"/> - </logger> - - <!-- BeanUtils generate to many DEBUG logs when sonar.verbose is set --> - <logger name="org.apache.commons.beanutils.converters"> - <level value="WARN"/> - </logger> - - <logger name="net.sf.ehcache"> - <level value="WARN"/> - </logger> - - <logger name="org.hibernate.cache.ReadWriteCache"> - <!-- removing "An item was expired by the cache while it was locked (increase your cache timeout)" msg --> - <level value="ERROR"/> - </logger> - <logger name="org.hibernate.cache.EhCacheProvider"> - <!-- removing "org.hibernate.cache.EhCacheProvider - Could not find configuratio)" message --> - <level value="ERROR"/> - </logger> - - <root> - <level value="${ROOT_LOGGER_LEVEL}"/> - <appender-ref ref="STDOUT"/> - </root> - -</configuration>
\ No newline at end of file |