diff options
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java | 107 | ||||
-rw-r--r-- | sonar-batch/src/main/resources/org/sonar/batch/bootstrapper/logback.xml (renamed from sonar-maven-plugin/src/main/resources/org/sonar/maven/logback.xml) | 46 | ||||
-rw-r--r-- | sonar-batch/src/main/resources/org/sonar/batch/logback.xml | 23 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java | 121 | ||||
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/config/Logback.java | 22 | ||||
-rw-r--r-- | sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java | 25 | ||||
-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 | ||||
-rw-r--r-- | sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java | 3 |
9 files changed, 323 insertions, 91 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 new file mode 100644 index 00000000000..85c77023a71 --- /dev/null +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrapper/LoggingConfiguration.java @@ -0,0 +1,107 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.batch.bootstrapper; + +import org.apache.commons.lang.StringUtils; +import org.sonar.core.config.Logback; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +/** + * @since 2.14 + */ +public final class LoggingConfiguration { + + public static final String PROPERTY_ROOT_LOGGER_LEVEL = "ROOT_LOGGER_LEVEL"; + public static final String PROPERTY_SQL_LOGGER_LEVEL = "SQL_LOGGER_LEVEL"; + public static final String PROPERTY_FORMAT = "FORMAT"; + + public static final String LEVEL_ROOT_VERBOSE = "DEBUG"; + public static final String LEVEL_ROOT_DEFAULT = "INFO"; + public static final String LEVEL_SQL_VERBOSE = "DEBUG"; + public static final String LEVEL_SQL_DEFAULT = "WARN"; + + public static final String FORMAT_DEFAULT = "%d{HH:mm:ss.SSS} %-5level - %msg%n"; + public static final String FORMAT_MAVEN = "[%level] [%d{HH:mm:ss.SSS}] %msg%n"; + + private Map<String, String> substitutionVariables = new HashMap<String, String>(); + + private LoggingConfiguration() { + setVerbose(false); + setShowSql(false); + setFormat(FORMAT_DEFAULT); + } + + public static LoggingConfiguration create() { + return new LoggingConfiguration(); + } + + public LoggingConfiguration setProperties(Map<String, String> properties) { + setShowSql("true".equals(properties.get("sonar.showSql"))); + setVerbose("true".equals(properties.get("sonar.verbose"))); + return this; + } + + public LoggingConfiguration setVerbose(boolean verbose) { + return setRootLevel(verbose ? LEVEL_ROOT_VERBOSE : LEVEL_ROOT_DEFAULT); + } + + public LoggingConfiguration setShowSql(boolean showSql) { + return setSqlLevel(showSql ? LEVEL_SQL_VERBOSE : LEVEL_SQL_DEFAULT); + } + + public LoggingConfiguration setRootLevel(String level) { + return addSubstitutionVariable(PROPERTY_ROOT_LOGGER_LEVEL, level); + } + + public LoggingConfiguration setSqlLevel(String level) { + return addSubstitutionVariable(PROPERTY_SQL_LOGGER_LEVEL, level); + } + + public LoggingConfiguration setFormat(String format) { + return addSubstitutionVariable(PROPERTY_FORMAT, StringUtils.defaultIfBlank(format, FORMAT_DEFAULT)); + } + + public LoggingConfiguration addSubstitutionVariable(String key, String value) { + substitutionVariables.put(key, value); + return this; + } + + String getSubstitutionVariable(String key) { + return substitutionVariables.get(key); + } + + public LoggingConfiguration configure(String classloaderPath) { + Logback.configure(classloaderPath, substitutionVariables); + return this; + } + + public LoggingConfiguration configure(File logbackFile) { + Logback.configure(logbackFile, substitutionVariables); + return this; + } + + public LoggingConfiguration configure() { + Logback.configure("/org/sonar/batch/bootstrapper/logback.xml", substitutionVariables); + return this; + } +} diff --git a/sonar-maven-plugin/src/main/resources/org/sonar/maven/logback.xml b/sonar-batch/src/main/resources/org/sonar/batch/bootstrapper/logback.xml index 5d6bf58530e..7dffc88d758 100644 --- a/sonar-maven-plugin/src/main/resources/org/sonar/maven/logback.xml +++ b/sonar-batch/src/main/resources/org/sonar/batch/bootstrapper/logback.xml @@ -1,40 +1,56 @@ <?xml version="1.0" encoding="UTF-8" ?> <configuration debug="false"> + <!-- + + This file is loaded by bootstrappers like Ant Task and Java Runner. + + Reasons to NOT move this configuration to bootstrappers: + - same lifecycle as sonar -> loggers are always up-to-date. No need to think about ascending/descending compatibility. + - parameters can be added without releasing new versions of bootstrappers + - XML format is up-to-date toward the version of Logback. + + --> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> - <pattern>[%level] [%d{HH:mm:ss.SSS}] %msg%n</pattern> + <pattern>${FORMAT}</pattern> </encoder> </appender> - <logger name="org.hibernate"> + <logger name="net.sf.ehcache"> <level value="WARN"/> </logger> - - <!-- set DEBUG to activate SQL logs. NOT RECOMMENDED --> - <logger name="org.hibernate.SQL"> + <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> + <logger name="org.hibernate"> + <level value="WARN"/> + </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"/> + <!-- sonar.showSql --> + <logger name="org.hibernate.SQL"> + <level value="${SQL_LOGGER_LEVEL:-ERROR}"/> </logger> - <logger name="org.hibernate.cache.EhCacheProvider"> - <!-- removing "org.hibernate.cache.EhCacheProvider - Could not find configuratio)" message --> - <level value="ERROR"/> + <logger name="java.sql.Statement"> + <level value="${SQL_LOGGER_LEVEL:-WARN}"/> + </logger> + <logger name="java.sql.PreparedStatement"> + <level value="${SQL_LOGGER_LEVEL:-WARN}"/> </logger> <root> + <!-- sonar.verbose --> <level value="${ROOT_LOGGER_LEVEL}"/> <appender-ref ref="STDOUT"/> </root> diff --git a/sonar-batch/src/main/resources/org/sonar/batch/logback.xml b/sonar-batch/src/main/resources/org/sonar/batch/logback.xml index 20df9b21d2c..b035225bfdc 100644 --- a/sonar-batch/src/main/resources/org/sonar/batch/logback.xml +++ b/sonar-batch/src/main/resources/org/sonar/batch/logback.xml @@ -2,12 +2,15 @@ <configuration debug="false"> <!-- - This file is directly loaded by Sonar Ant Task 1.1 and Sonar Runner 1.1. + + This file is deprecated. It's replaced by org/sonar/batch/bootstrapper/logback.xml. + It can't be deleted as long as Ant Task and Java Runner do not use org.sonar.batch.bootstrapper.LoggingConfiguration. + --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> - <pattern>%d{HH:mm:ss.SSS} %-5level %msg%n</pattern> + <pattern>%d{HH:mm:ss.SSS} %-5level %30.30logger{30} - %msg%n</pattern> </encoder> </appender> @@ -22,10 +25,6 @@ <!-- removing "org.hibernate.cache.EhCacheProvider - Could not find configuratio)" message --> <level value="ERROR"/> </logger> - <!-- set DEBUG to activate SQL logs. NOT RECOMMENDED --> - <logger name="org.hibernate.SQL"> - <level value="ERROR"/> - </logger> <logger name="org.hibernate"> <level value="WARN"/> </logger> @@ -35,7 +34,19 @@ <level value="WARN"/> </logger> + <!-- sonar.showSql --> + <logger name="org.hibernate.SQL"> + <level value="${SQL_LOGGER_LEVEL:-ERROR}"/> + </logger> + <logger name="java.sql.Statement"> + <level value="${SQL_LOGGER_LEVEL:-WARN}"/> + </logger> + <logger name="java.sql.PreparedStatement"> + <level value="${SQL_LOGGER_LEVEL:-WARN}"/> + </logger> + <root> + <!-- sonar.verbose --> <level value="${ROOT_LOGGER_LEVEL}"/> <appender-ref ref="STDOUT"/> </root> 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 new file mode 100644 index 00000000000..cb67f21865f --- /dev/null +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrapper/LoggingConfigurationTest.java @@ -0,0 +1,121 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.batch.bootstrapper; + +import com.google.common.collect.Maps; +import org.hamcrest.core.Is; +import org.junit.Test; + +import java.util.Map; + +import static org.junit.Assert.assertThat; + +public class LoggingConfigurationTest { + + @Test + public void testSqlLevel() { + assertThat(LoggingConfiguration.create().setShowSql(true) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_SQL_VERBOSE)); + + assertThat(LoggingConfiguration.create().setShowSql(false) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_SQL_DEFAULT)); + + assertThat(LoggingConfiguration.create().setSqlLevel("ERROR") + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL), Is.is("ERROR")); + } + + @Test + public void shouldNotShowSqlByDefault() { + assertThat(LoggingConfiguration.create() + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_SQL_DEFAULT)); + } + + @Test + public void testSetVerbose() { + assertThat(LoggingConfiguration.create().setVerbose(true) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_ROOT_VERBOSE)); + + assertThat(LoggingConfiguration.create().setVerbose(false) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_ROOT_DEFAULT)); + + assertThat(LoggingConfiguration.create().setRootLevel("ERROR") + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL), Is.is("ERROR")); + } + + @Test + public void shouldNotBeVerboseByDefault() { + assertThat(LoggingConfiguration.create() + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_ROOT_DEFAULT)); + } + + @Test + public void testSetVerboseProperty() { + Map<String, String> properties = Maps.newHashMap(); + assertThat(LoggingConfiguration.create().setProperties(properties) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_ROOT_DEFAULT)); + + properties.put("sonar.verbose", "true"); + assertThat(LoggingConfiguration.create().setProperties(properties) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_ROOT_VERBOSE)); + + properties.put("sonar.verbose", "false"); + assertThat(LoggingConfiguration.create().setProperties(properties) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_ROOT_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_ROOT_DEFAULT)); + } + + @Test + public void testSetShowSqlProperty() { + Map<String, String> properties = Maps.newHashMap(); + assertThat(LoggingConfiguration.create().setProperties(properties) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_SQL_DEFAULT)); + + properties.put("sonar.showSql", "true"); + assertThat(LoggingConfiguration.create().setProperties(properties) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_SQL_VERBOSE)); + + properties.put("sonar.showSql", "false"); + assertThat(LoggingConfiguration.create().setProperties(properties) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_SQL_LOGGER_LEVEL), Is.is(LoggingConfiguration.LEVEL_SQL_DEFAULT)); + } + + @Test + public void testDefaultFormat() { + assertThat(LoggingConfiguration.create() + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_FORMAT), Is.is(LoggingConfiguration.FORMAT_DEFAULT)); + } + + @Test + public void testSetFormat() { + assertThat(LoggingConfiguration.create().setFormat("%d %level") + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_FORMAT), Is.is("%d %level")); + } + + @Test + public void shouldNotSetBlankFormat() { + assertThat(LoggingConfiguration.create().setFormat(null) + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_FORMAT), Is.is(LoggingConfiguration.FORMAT_DEFAULT)); + + assertThat(LoggingConfiguration.create().setFormat("") + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_FORMAT), Is.is(LoggingConfiguration.FORMAT_DEFAULT)); + + assertThat(LoggingConfiguration.create().setFormat(" ") + .getSubstitutionVariable(LoggingConfiguration.PROPERTY_FORMAT), Is.is(LoggingConfiguration.FORMAT_DEFAULT)); + } +} diff --git a/sonar-core/src/main/java/org/sonar/core/config/Logback.java b/sonar-core/src/main/java/org/sonar/core/config/Logback.java index 2063a28935a..df2892ceaf4 100644 --- a/sonar-core/src/main/java/org/sonar/core/config/Logback.java +++ b/sonar-core/src/main/java/org/sonar/core/config/Logback.java @@ -31,6 +31,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.util.Map; /** * Configure Logback @@ -43,18 +44,18 @@ public final class Logback { // only static methods } - public static void configure(String classloaderPath) { + public static void configure(String classloaderPath, Map<String, String> substitutionVariables) { InputStream input = Logback.class.getResourceAsStream(classloaderPath); if (input == null) { throw new IllegalArgumentException("Logback configuration not found in classloader: " + classloaderPath); } - configure(input); + configure(input, substitutionVariables); } - public static void configure(File logbackFile) { + public static void configure(File logbackFile, Map<String, String> substitutionVariables) { try { FileInputStream input = FileUtils.openInputStream(logbackFile); - configure(input); + configure(input, substitutionVariables); } catch (IOException e) { throw new IllegalArgumentException("Fail to load the Logback configuration: " + logbackFile, e); } @@ -63,12 +64,11 @@ public final class Logback { /** * Note that this method closes the input stream */ - private static void configure(InputStream input) { + private static void configure(InputStream input, Map<String, String> substitutionVariables) { LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); try { JoranConfigurator configurator = new JoranConfigurator(); - configurator.setContext(lc); - lc.reset(); + configurator.setContext(configureContext(lc, substitutionVariables)); configurator.doConfigure(input); } catch (JoranException e) { // StatusPrinter will handle this @@ -77,4 +77,12 @@ public final class Logback { } StatusPrinter.printInCaseOfErrorsOrWarnings(lc); } + + private static LoggerContext configureContext(LoggerContext context, Map<String, String> substitutionVariables) { + context.reset(); + for (Map.Entry<String, String> entry : substitutionVariables.entrySet()) { + context.putProperty(entry.getKey(), entry.getValue()); + } + return context; + } } 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(); } } 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 diff --git a/sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java b/sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java index c18cf21c15e..04f25b7a8fb 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java @@ -24,6 +24,7 @@ import org.sonar.core.config.Logback; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import java.io.File; +import java.util.Collections; public final class PlatformLifecycleListener implements ServletContextListener { @@ -41,6 +42,6 @@ public final class PlatformLifecycleListener implements ServletContextListener { * Configure Logback with $SONAR_HOME/conf/logback.xml */ private void configureLogback() { - Logback.configure(new File(SonarHome.getHome(), "conf/logback.xml")); + Logback.configure(new File(SonarHome.getHome(), "conf/logback.xml"), Collections.<String, String>emptyMap()); } } |