]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4898 fix some logs
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 31 Jul 2014 20:48:49 +0000 (22:48 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 31 Jul 2014 20:49:00 +0000 (22:49 +0200)
server/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java
server/sonar-server/src/main/java/org/sonar/server/app/Logging.java
server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java
server/sonar-server/src/main/java/org/sonar/server/search/ESNode.java

index d75a2fc4588f42cd1611b31017eb4f65bcb1e146..20cf4e62a07e8db16e88bdf03ea3dd5ffe65bcc4 100644 (file)
@@ -76,6 +76,8 @@ public abstract class MonitoredProcess implements ProcessMXBean {
       public void run() {
         long time = System.currentTimeMillis();
         if (time - lastPing > AUTOKILL_TIMEOUT_MS) {
+          LoggerFactory.getLogger(getClass()).info(String.format(
+            "Did not receive any ping during %d seconds. Shutting down.", AUTOKILL_TIMEOUT_MS / 1000));
           terminate();
         }
       }
index d2e1ed70e766d358e0f2b8fc803b7855c8a287fc..0610bcdd7ed1d5d01f92ba8ceb39961fbc7e133e 100644 (file)
@@ -78,15 +78,11 @@ class Logging {
   }
 
   static void configure(Tomcat tomcat, Props props) {
-    tomcat.setSilent(false);
-    tomcat.getService().addLifecycleListener(new LifecycleLogger(console()));
+    tomcat.setSilent(true);
+    tomcat.getService().addLifecycleListener(new LifecycleLogger(LoggerFactory.getLogger(Logging.class)));
     configureLogbackAccess(tomcat, props);
   }
 
-  static Logger console() {
-    return LoggerFactory.getLogger("console");
-  }
-
   private static void configureLogbackAccess(Tomcat tomcat, Props props) {
     if (props.booleanOf(PROPERTY_ENABLE_ACCESS_LOGS, true)) {
       LogbackValve valve = new LogbackValve();
index 2371978637ea38d1bacc8555c3c445476362975f..466c78b9664201bebc56d243429be98aa7bd29f4 100644 (file)
@@ -38,6 +38,13 @@ class Webapp {
       String webDir = props.of("sonar.path.web");
       LoggerFactory.getLogger(Webapp.class).info("Webapp directory: " + webDir);
       StandardContext context = (StandardContext) tomcat.addWebapp(getContextPath(props), webDir);
+      context.setClearReferencesHttpClientKeepAliveThread(false);
+      context.setClearReferencesStatic(false);
+      context.setClearReferencesStopThreads(false);
+      context.setClearReferencesStopTimerThreads(false);
+      context.setClearReferencesStopTimerThreads(false);
+      context.setAntiResourceLocking(false);
+      context.setAntiJARLocking(false);
       context.setReloadable(false);
       context.setUseHttpOnly(true);
       context.setProcessTlds(false);
index 4213543b164f4582e2b20e1ec55eaf27d75a1813..a6e28704afad13040c0a499f998c0765009a97c5 100644 (file)
@@ -63,8 +63,6 @@ public class ESNode implements Startable {
   private Client client;
   private Node node;
   protected final Profiling profiling;
-  private final Profiling.Level profilingLevel;
-
 
   public ESNode(Settings settings) {
     this(settings, DEFAULT_HEALTH_TIMEOUT);
@@ -75,8 +73,6 @@ public class ESNode implements Startable {
     this.settings = settings;
     this.healthTimeout = healthTimeout;
     this.profiling = new Profiling(settings);
-    String settingsValue = settings.getString(Profiling.CONFIG_PROFILING_LEVEL);
-    this.profilingLevel = Profiling.Level.fromConfigString(settingsValue);
   }
 
   @Override
@@ -190,40 +186,40 @@ public class ESNode implements Startable {
     esSettings
       .put("index.mapper.dynamic", false)
 
-        // Sortable text analyzer
+      // Sortable text analyzer
       .put("index.analysis.analyzer.sortable.type", "custom")
       .put("index.analysis.analyzer.sortable.tokenizer", "keyword")
       .putArray("index.analysis.analyzer.sortable.filter", "trim", "lowercase", "truncate")
 
-        // Edge NGram index-analyzer
+      // Edge NGram index-analyzer
       .put("index.analysis.analyzer.index_grams.type", "custom")
       .put("index.analysis.analyzer.index_grams.tokenizer", "whitespace")
       .putArray("index.analysis.analyzer.index_grams.filter", "trim", "lowercase", "gram_filter")
 
-        // Edge NGram search-analyzer
+      // Edge NGram search-analyzer
       .put("index.analysis.analyzer.search_grams.type", "custom")
       .put("index.analysis.analyzer.search_grams.tokenizer", "whitespace")
       .putArray("index.analysis.analyzer.search_grams.filter", "trim", "lowercase")
 
-        // Word index-analyzer
+      // Word index-analyzer
       .put("index.analysis.analyzer.index_words.type", "custom")
       .put("index.analysis.analyzer.index_words.tokenizer", "standard")
       .putArray("index.analysis.analyzer.index_words.filter",
         "standard", "word_filter", "lowercase", "stop", "asciifolding", "porter_stem")
 
-        // Word search-analyzer
+      // Word search-analyzer
       .put("index.analysis.analyzer.search_words.type", "custom")
       .put("index.analysis.analyzer.search_words.tokenizer", "standard")
       .putArray("index.analysis.analyzer.search_words.filter",
         "standard", "lowercase", "stop", "asciifolding", "porter_stem")
 
-        // Edge NGram filter
+      // Edge NGram filter
       .put("index.analysis.filter.gram_filter.type", "edgeNGram")
       .put("index.analysis.filter.gram_filter.min_gram", 2)
       .put("index.analysis.filter.gram_filter.max_gram", 15)
       .putArray("index.analysis.filter.gram_filter.token_chars", "letter", "digit", "punctuation", "symbol")
 
-        // Word filter
+      // Word filter
       .put("index.analysis.filter.word_filter.type", "word_delimiter")
       .put("index.analysis.filter.word_filter.generate_word_parts", true)
       .put("index.analysis.filter.word_filter.catenate_words", true)
@@ -234,7 +230,7 @@ public class ESNode implements Startable {
       .put("index.analysis.filter.word_filter.split_on_numerics", true)
       .put("index.analysis.filter.word_filter.stem_english_possessive", true)
 
-        // Path Analyzer
+      // Path Analyzer
       .put("index.analysis.analyzer.path_analyzer.type", "custom")
       .put("index.analysis.analyzer.path_analyzer.tokenizer", "path_hierarchy");
 
@@ -291,10 +287,7 @@ public class ESNode implements Startable {
   }
 
   public <K extends ActionResponse> K execute(ActionRequestBuilder action) {
-    StopWatch requestProfile = null;
-    if (profilingLevel.ordinal() >= Profiling.Level.BASIC.ordinal()) {
-      requestProfile = profiling.start("search", Profiling.Level.BASIC);
-    }
+    StopWatch requestProfile = profiling.start("search", Profiling.Level.BASIC);
     ListenableActionFuture acc = action.execute();
     try {
       K response = (K) acc.get();
@@ -303,7 +296,7 @@ public class ESNode implements Startable {
       throw new IllegalStateException("ES error: ", e);
     } finally {
       if (requestProfile != null) {
-        requestProfile.stop(action.toString());
+        requestProfile.stop("Requested: ", action);
       }
     }
   }