aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-07-30 18:04:58 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-07-30 18:04:58 +0200
commit1be85fe80d23502a0cc0f61a6d53b50dc32c0ceb (patch)
tree4862e5564f23e9542c68dadbad1b167bfb1ff7e1
parent019079b710f70ce19a449c0d6d209ecc2569a00a (diff)
downloadsonarqube-1be85fe80d23502a0cc0f61a6d53b50dc32c0ceb.tar.gz
sonarqube-1be85fe80d23502a0cc0f61a6d53b50dc32c0ceb.zip
SONAR-4898 fix logs
-rw-r--r--server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java7
-rw-r--r--server/sonar-server/src/main/resources/org/sonar/server/platform/logback.xml1
-rw-r--r--sonar-application/src/main/java/org/sonar/application/App.java9
3 files changed, 10 insertions, 7 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java
index 9529a799898..5639df18a9d 100644
--- a/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java
+++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessWrapper.java
@@ -146,7 +146,7 @@ public class ProcessWrapper extends Thread implements Terminable {
processBuilder.environment().putAll(envProperties);
try {
- LOGGER.info("Starting {} process with command line: {}", getName(), StringUtils.join(command, " "));
+ LOGGER.info("starting {}: {}", getName(), StringUtils.join(command, " "));
process = processBuilder.start();
errorGobbler = new StreamGobbler(process.getErrorStream(), this.getName() + "-ERROR");
outputGobbler = new StreamGobbler(process.getInputStream(), this.getName());
@@ -260,6 +260,7 @@ public class ProcessWrapper extends Thread implements Terminable {
@Override
public void terminate() {
if (processMXBean != null && process != null) {
+ LOGGER.info("{} stopping", getName());
// Send the terminate command to process in order to gracefully shutdown.
// Then hardly kill it if it didn't terminate in 30 seconds
ScheduledExecutorService killer = Executors.newScheduledThreadPool(1);
@@ -274,11 +275,11 @@ public class ProcessWrapper extends Thread implements Terminable {
ScheduledFuture killerFuture = killer.schedule(killerTask, 30, TimeUnit.SECONDS);
processMXBean.terminate();
killerFuture.cancel(true);
- LOGGER.info("{} process stopped", getName());
+ LOGGER.info("{} stopped", getName());
} catch (Exception ignored) {
// ignore
- ignored.printStackTrace();
+
} finally {
killer.shutdownNow();
}
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/platform/logback.xml b/server/sonar-server/src/main/resources/org/sonar/server/platform/logback.xml
index 19d87729302..b95bf1cfe30 100644
--- a/server/sonar-server/src/main/resources/org/sonar/server/platform/logback.xml
+++ b/server/sonar-server/src/main/resources/org/sonar/server/platform/logback.xml
@@ -94,7 +94,6 @@
<root>
<level value="INFO"/>
<appender-ref ref="LOGFILE"/>
- <appender-ref ref="CONSOLE"/>
</root>
</configuration>
diff --git a/sonar-application/src/main/java/org/sonar/application/App.java b/sonar-application/src/main/java/org/sonar/application/App.java
index daf1e53c205..dcfa2126811 100644
--- a/sonar-application/src/main/java/org/sonar/application/App.java
+++ b/sonar-application/src/main/java/org/sonar/application/App.java
@@ -60,7 +60,7 @@ public class App implements ProcessMXBean {
if (elasticsearch.execute()) {
monitor.registerProcess(elasticsearch);
if (elasticsearch.waitForReady()) {
- logger.info("Search server is ready");
+ logger.info("search server is up");
server = new ProcessWrapper(JmxUtils.WEB_SERVER_NAME)
.setWorkDir(installation.homeDir())
@@ -81,7 +81,7 @@ public class App implements ProcessMXBean {
monitor.registerProcess(server);
if (server.waitForReady()) {
success = true;
- logger.info("Web server is ready");
+ logger.info("web server is up");
monitor.join();
}
}
@@ -104,7 +104,6 @@ public class App implements ProcessMXBean {
@Override
public void terminate() {
- LoggerFactory.getLogger(App.class).info("Stopping");
if (monitor != null && monitor.isAlive()) {
monitor.terminate();
monitor.interrupt();
@@ -128,7 +127,11 @@ public class App implements ProcessMXBean {
Installation installation = new Installation();
new AppLogging().configure(installation);
App app = new App(installation);
+
+ // start and wait for shutdown command
app.start();
+
+ LoggerFactory.getLogger(App.class).info("stopped");
System.exit(app.isSuccess() ? 0 : 1);
}
}