aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-application
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-10-09 18:44:11 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-10-09 18:44:11 +0200
commit45e2d5db126fd13552b56f51ad5ead72615e71d0 (patch)
treead63ac861c02c8eaf66378f5bff9f853907b5fe3 /sonar-application
parente72f4ca2d9be6d3dafd345664cc7244efd2a5a7c (diff)
downloadsonarqube-45e2d5db126fd13552b56f51ad5ead72615e71d0.tar.gz
sonarqube-45e2d5db126fd13552b56f51ad5ead72615e71d0.zip
SONAR-2881 Do not rebuild the WAR file when changing conf/logback.xml
Diffstat (limited to 'sonar-application')
-rw-r--r--sonar-application/pom.xml20
-rw-r--r--sonar-application/src/main/assembly/conf/logback.xml48
-rw-r--r--sonar-application/src/main/assembly/war/build.xml20
-rw-r--r--sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java8
-rw-r--r--sonar-application/src/main/java/org/sonar/application/StartServer.java12
5 files changed, 17 insertions, 91 deletions
diff --git a/sonar-application/pom.xml b/sonar-application/pom.xml
index 2e009da50ef..f4c91172d7a 100644
--- a/sonar-application/pom.xml
+++ b/sonar-application/pom.xml
@@ -83,26 +83,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- </dependency>
- <dependency>
- <groupId>janino</groupId>
- <artifactId>janino</artifactId>
- </dependency>
- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
diff --git a/sonar-application/src/main/assembly/conf/logback.xml b/sonar-application/src/main/assembly/conf/logback.xml
index 407cbdbe265..e84e65ad635 100644
--- a/sonar-application/src/main/assembly/conf/logback.xml
+++ b/sonar-application/src/main/assembly/conf/logback.xml
@@ -2,72 +2,42 @@
<configuration debug="false">
- <!-- appender used when deploying Sonar WAR on a JEE server -->
- <appender name="SONAR_WAR" class="ch.qos.logback.core.ConsoleAppender">
- <!-- avoid to log 404 file not found messages from the rails file servlet -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator name="mavenRepoFileNotFound">
- <expression>message.startsWith("files: File not found: /maven")</expression>
- </evaluator>
- <OnMismatch>NEUTRAL</OnMismatch>
- <OnMatch>DENY</OnMatch>
- </filter>
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>
- %d{yyyy.MM.dd HH:mm:ss} %-5level %logger{20} %X %msg%n
- </pattern>
- </layout>
- </appender>
-
- <!-- SONAR_STANDALONE/ -->
- <!-- do not edit/remove the previous comment -->
<appender name="SONAR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <File>../../logs/sonar.log</File>
+ <File>${SONAR_HOME}/logs/sonar.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <param name="FileNamePattern" value="../../logs/sonar.%i.log"/>
+ <param name="FileNamePattern" value="${SONAR_HOME}/logs/sonar.%i.log"/>
<param name="MinIndex" value="1"/>
<param name="MaxIndex" value="3"/>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<param name="MaxFileSize" value="5MB"/>
</triggeringPolicy>
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator name="mavenRepoFileNotFound">
- <expression>message.startsWith("files: File not found: /maven")</expression>
- </evaluator>
- <OnMismatch>NEUTRAL</OnMismatch>
- <OnMatch>DENY</OnMatch>
- </filter>
- <layout class="ch.qos.logback.classic.PatternLayout">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>
%d{yyyy.MM.dd HH:mm:ss} %-5level %logger{20} %X %msg%n
</pattern>
- </layout>
+ </encoder>
</appender>
<!-- appender used to profile Sonar Server -->
<appender name="PROFILING_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <File>../../logs/profiling.log</File>
+ <File>${SONAR_HOME}/logs/profiling.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <param name="FileNamePattern" value="../../logs/profiling.%i.log"/>
+ <param name="FileNamePattern" value="${SONAR_HOME}/logs/profiling.%i.log"/>
<param name="MinIndex" value="1"/>
<param name="MaxIndex" value="3"/>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<param name="MaxFileSize" value="5MB"/>
</triggeringPolicy>
- <layout class="ch.qos.logback.classic.PatternLayout">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>
%d{yyyy.MM.dd HH:mm:ss} %-5level %logger{20} %X %msg%n
</pattern>
- </layout>
+ </encoder>
</appender>
- <!-- do not edit/remove the following comment -->
- <!-- /SONAR_STANDALONE -->
-
-
- <!--
+ <!--
Profiling of JRuby on Rails requests . Uncomment in order to log HTTP and SQL requests.
Execute the following command to get the HTTP requests with execution time > 10s :
grep 'rails Completed in [0-9]\{5,\}ms' < profiling.log
diff --git a/sonar-application/src/main/assembly/war/build.xml b/sonar-application/src/main/assembly/war/build.xml
index 0832a7a58ff..9a2467fb881 100644
--- a/sonar-application/src/main/assembly/war/build.xml
+++ b/sonar-application/src/main/assembly/war/build.xml
@@ -32,25 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
<fileset dir="../extensions/jdbc-driver" includes="**/*.jar"/>
</copy>
- <replace file="build/sonar-server/WEB-INF/classes/sonar-war.properties" token="#sonar.home=" value="sonar.home=${sonarHome}" />
-
- <!-- copy the logback config -->
- <copy todir="build/sonar-server/WEB-INF/classes">
- <fileset dir="../conf" includes="logback.xml"/>
- </copy>
-
- <!-- remove appenders configured for standalone mode -->
- <replace file="build/sonar-server/WEB-INF/classes/logback.xml">
- <replacetoken><![CDATA[<appender-ref ref="SONAR_FILE"/>]]></replacetoken>
- <replacevalue><![CDATA[<appender-ref ref="SONAR_WAR"/>]]></replacevalue>
- </replace>
- <replace file="build/sonar-server/WEB-INF/classes/logback.xml">
- <replacetoken><![CDATA[<appender-ref ref="PROFILING_FILE"/>]]></replacetoken>
- <replacevalue><![CDATA[<appender-ref ref="SONAR_WAR"/>]]></replacevalue>
- </replace>
-
- <!-- see SONAR-1811. The appender SONAR_FILE must be removed from logback configuration -->
- <replaceregexp file="build/sonar-server/WEB-INF/classes/logback.xml" match="SONAR_STANDALONE/(.*)/SONAR_STANDALONE" replace="" byline="false" flags="gs"/>
+ <replace file="build/sonar-server/WEB-INF/classes/sonar-war.properties" token="#SONAR_HOME=" value="SONAR_HOME=${sonarHome}" />
<war destfile="sonar.war" webxml="build/sonar-server/WEB-INF/web.xml">
<fileset dir="build/sonar-server"/>
diff --git a/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java b/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
index 37b9c9c216b..713ecab0267 100644
--- a/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
+++ b/sonar-application/src/main/java/org/sonar/application/JettyEmbedder.java
@@ -29,7 +29,6 @@ import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.thread.QueuedThreadPool;
import org.mortbay.xml.XmlConfiguration;
-import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
@@ -85,11 +84,12 @@ public class JettyEmbedder {
try {
server.stop();
} catch (Exception e) {
- LoggerFactory.getLogger(getClass()).error("Can not stop the Jetty server", e);
+ System.err.println("Can not stop the Jetty server");
+ e.printStackTrace();
}
}
});
- LoggerFactory.getLogger("org.sonar.INFO").info("Sonar started: " + toString());
+// LoggerFactory.getLogger("org.sonar.INFO").info("Sonar started: " + toString());
}
private Server configureProgrammatically() throws URISyntaxException, IOException {
@@ -123,7 +123,7 @@ public class JettyEmbedder {
connector.setAcceptors(2);
connector.setConfidentialPort(8443);
if (ajp13Port > 0) {
- LoggerFactory.getLogger("org.sonar.INFO").info("AJP13 connector is on port " + ajp13Port);
+ System.out.println("AJP13 connector is on port " + ajp13Port);
Connector ajpConnector = new Ajp13SocketConnector();
ajpConnector.setPort(ajp13Port);
server.addConnector(ajpConnector);
diff --git a/sonar-application/src/main/java/org/sonar/application/StartServer.java b/sonar-application/src/main/java/org/sonar/application/StartServer.java
index c92b5069e6e..1af81c86d0e 100644
--- a/sonar-application/src/main/java/org/sonar/application/StartServer.java
+++ b/sonar-application/src/main/java/org/sonar/application/StartServer.java
@@ -34,7 +34,6 @@ public final class StartServer {
}
public static void main(String[] args) throws Exception {
- configureLogback();
configureHome();
Properties configuration = getConfiguration();
@@ -51,7 +50,7 @@ public final class StartServer {
private static void configureRequestLogs(JettyEmbedder jetty, Properties configuration) {
String filenamePattern = configuration.getProperty("sonar.web.jettyRequestLogs");
- if (filenamePattern!=null) {
+ if (filenamePattern != null) {
jetty.configureRequestLogs(filenamePattern);
}
}
@@ -64,12 +63,7 @@ public final class StartServer {
private static void configureHome() throws URISyntaxException {
File confFile = new File(StartServer.class.getResource("/conf/sonar.properties").toURI());
- System.setProperty("sonar.home", confFile.getParentFile().getParentFile().getAbsolutePath());
- }
-
- private static void configureLogback() throws URISyntaxException {
- File confFile = new File(StartServer.class.getResource("/conf/logback.xml").toURI());
- System.setProperty("logback.configurationFile", confFile.getAbsolutePath());
- System.setProperty("logback.ContextSelector", "JNDI");
+ System.setProperty("SONAR_HOME" /* see constant org.sonar.server.platform.SonarHome.PROPERTY */,
+ confFile.getParentFile().getParentFile().getAbsolutePath());
}
}