From: Simon Brandhof Date: Thu, 31 Jul 2014 20:48:49 +0000 (+0200) Subject: SONAR-4898 fix some logs X-Git-Tag: 4.5-RC1~307 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6849b22ad9fb4227bdc2a3f210d7c9d041331885;p=sonarqube.git SONAR-4898 fix some logs --- diff --git a/server/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java b/server/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java index d75a2fc4588..20cf4e62a07 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java +++ b/server/sonar-process/src/main/java/org/sonar/process/MonitoredProcess.java @@ -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(); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java b/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java index d2e1ed70e76..0610bcdd7ed 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java +++ b/server/sonar-server/src/main/java/org/sonar/server/app/Logging.java @@ -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(); diff --git a/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java b/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java index 2371978637e..466c78b9664 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java +++ b/server/sonar-server/src/main/java/org/sonar/server/app/Webapp.java @@ -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); diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/ESNode.java b/server/sonar-server/src/main/java/org/sonar/server/search/ESNode.java index 4213543b164..a6e28704afa 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/ESNode.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/ESNode.java @@ -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 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); } } }