diff options
4 files changed, 10 insertions, 6 deletions
diff --git a/sonar-application/src/main/java/org/sonar/application/Webapp.java b/sonar-application/src/main/java/org/sonar/application/Webapp.java index a84e705fcaf..c91d74d0f3f 100644 --- a/sonar-application/src/main/java/org/sonar/application/Webapp.java +++ b/sonar-application/src/main/java/org/sonar/application/Webapp.java @@ -28,14 +28,14 @@ class Webapp { private static final String JRUBY_MAX_RUNTIMES = "jruby.max.runtimes"; private static final String RAILS_ENV = "rails.env"; private static final String PROPERTY_CONTEXT = "sonar.web.context"; - private static final String PROPERTY_LOG_VERBOSE = "sonar.log.verbose"; + private static final String PROPERTY_LOG_PROFILING_LEVEL = "sonar.log.profilingLevel"; static void configure(Tomcat tomcat, Env env, Props props) { String ctx = getContext(props); try { Context context = tomcat.addWebapp(ctx, env.file("web").getAbsolutePath()); context.setConfigFile(env.file("web/META-INF/context.xml").toURI().toURL()); - context.addParameter(PROPERTY_LOG_VERBOSE, props.of(PROPERTY_LOG_VERBOSE, "false")); + context.addParameter(PROPERTY_LOG_PROFILING_LEVEL, props.of(PROPERTY_LOG_PROFILING_LEVEL, "NONE")); configureRailsMode(props, context); context.setJarScanner(new NullJarScanner()); 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 c4ea1c64db2..b1ba8ad15e6 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 @@ -22,6 +22,7 @@ package org.sonar.server.platform; import com.google.common.collect.ImmutableMap; import org.slf4j.LoggerFactory; import org.sonar.core.config.Logback; +import org.sonar.core.profiling.Profiling; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; @@ -62,8 +63,8 @@ public final class PlatformLifecycleListener implements ServletContextListener { * Configure Logback from classpath, with configuration from sonar.properties */ private void configureLogback(ServletContextEvent event) { - boolean sonarLogVerbose = Boolean.valueOf(event.getServletContext().getInitParameter("sonar.log.verbose")); - Map<String, String> variables = ImmutableMap.of("ROOT_LOGGER_LEVEL", sonarLogVerbose ? "DEBUG" : "INFO"); + Profiling.Level profilingLevel = Profiling.Level.fromConfigString(event.getServletContext().getInitParameter(Profiling.CONFIG_PROFILING_LEVEL)); + Map<String, String> variables = ImmutableMap.of("RAILS_LOGGER_LEVEL", profilingLevel == Profiling.Level.FULL ? "DEBUG" : "WARN"); Logback.configure("/org/sonar/server/platform/logback.xml", variables); } } diff --git a/sonar-server/src/main/resources/org/sonar/server/platform/logback.xml b/sonar-server/src/main/resources/org/sonar/server/platform/logback.xml index c3253c6e5ca..f7f9991eaca 100644 --- a/sonar-server/src/main/resources/org/sonar/server/platform/logback.xml +++ b/sonar-server/src/main/resources/org/sonar/server/platform/logback.xml @@ -42,7 +42,7 @@ <!-- Display Rails warnings and errors --> <logger name="rails"> - <level value="WARN"/> + <level value="${RAILS_LOGGER_LEVEL}"/> </logger> <logger name="org.hibernate.cache.ReadWriteCache"> @@ -84,7 +84,7 @@ </logger> <root> - <level value="${ROOT_LOGGER_LEVEL}"/> + <level value="INFO"/> <appender-ref ref="LOGFILE"/> </root> diff --git a/sonar-server/src/main/webapp/WEB-INF/config/environment.rb b/sonar-server/src/main/webapp/WEB-INF/config/environment.rb index 3daac2cf7a8..b9617c65696 100644 --- a/sonar-server/src/main/webapp/WEB-INF/config/environment.rb +++ b/sonar-server/src/main/webapp/WEB-INF/config/environment.rb @@ -97,6 +97,9 @@ Rails::Initializer.run do |config| # Provided by JRuby-Rack config.action_controller.session_store = :java_servlet_store + # Prevent appearance of ANSI style escape sequences in logs + config.active_record.colorize_logging = false + # Use SQL instead of Active Record's schema dumper when creating the test database. # This is necessary if your schema can't be completely dumped by the schema dumper, # like if you have constraints or database-specific column types |