aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-application
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-application')
-rw-r--r--sonar-application/src/main/java/org/sonar/application/App.java6
-rw-r--r--sonar-application/src/main/resources/org/sonar/application/logback.xml33
2 files changed, 36 insertions, 3 deletions
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 bba2dd73069..502cf561394 100644
--- a/sonar-application/src/main/java/org/sonar/application/App.java
+++ b/sonar-application/src/main/java/org/sonar/application/App.java
@@ -109,7 +109,11 @@ public class App implements Stoppable {
CommandLineParser cli = new CommandLineParser();
Properties rawProperties = cli.parseArguments(args);
Props props = new PropsBuilder(rawProperties, new JdbcSettings()).build();
- new ProcessLogging().configure(props, "/org/sonar/application/logback.xml");
+ ProcessLogging logging = new ProcessLogging();
+ logging.configure(props, "/org/sonar/application/logback.xml");
+ if (props.valueAsBoolean("sonar.log.console", false)) {
+ logging.addConsoleAppender();
+ }
App app = new App();
app.start(props);
diff --git a/sonar-application/src/main/resources/org/sonar/application/logback.xml b/sonar-application/src/main/resources/org/sonar/application/logback.xml
index 246afdf89f3..cbcd991ded9 100644
--- a/sonar-application/src/main/resources/org/sonar/application/logback.xml
+++ b/sonar-application/src/main/resources/org/sonar/application/logback.xml
@@ -3,17 +3,46 @@
<configuration debug="false">
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
+ <appender name="LOGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <File>${sonar.path.logs}/sonar.log</File>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <param name="FileNamePattern" value="${sonar.path.logs}/sonar.%i.log"/>
+ <param name="MinIndex" value="1"/>
+ <param name="MaxIndex" value="5"/>
+ </rollingPolicy>
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <param name="MaxFileSize" value="10MB"/>
+ </triggeringPolicy>
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="APP" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%d{yyyy.MM.dd HH:mm:ss} %-5level app[%logger{20}] %msg%n</pattern>
+ </encoder>
+ </appender>
+
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>
- %d{yyyy.MM.dd HH:mm:ss} %-5level %msg%n
+ %msg%n
</pattern>
</encoder>
</appender>
+ <logger name="console" additivity="false">
+ <appender-ref ref="CONSOLE"/>
+ </logger>
+
+ <logger name="gobbler" additivity="false">
+ <appender-ref ref="LOGFILE"/>
+ </logger>
+
<root>
<level value="INFO"/>
- <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="APP"/>
</root>
</configuration>