diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-09-24 14:35:43 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-09-24 14:36:00 +0200 |
commit | 410c98978ca7ee3c667dcbcffe4d3ec085c6e517 (patch) | |
tree | 7e1d65c2fbf679592506ab302011053e55a3f322 /sonar-application/src/main | |
parent | 3bd213ad94caa90487e03c6e3444a7d3d8e40fee (diff) | |
download | sonarqube-410c98978ca7ee3c667dcbcffe4d3ec085c6e517.tar.gz sonarqube-410c98978ca7ee3c667dcbcffe4d3ec085c6e517.zip |
SONAR-5621 merge log files
Diffstat (limited to 'sonar-application/src/main')
-rw-r--r-- | sonar-application/src/main/java/org/sonar/application/App.java | 6 | ||||
-rw-r--r-- | sonar-application/src/main/resources/org/sonar/application/logback.xml | 23 |
2 files changed, 26 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..e34156819f0 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,36 @@ <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>%3.3logger %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 + app %d{yyyy.MM.dd HH:mm:ss} %-5level [%logger{20}] %msg%n </pattern> </encoder> </appender> + <logger name="console"> + <appender-ref ref="CONSOLE"/> + </logger> + <root> <level value="INFO"/> - <appender-ref ref="CONSOLE"/> + <appender-ref ref="LOGFILE"/> </root> </configuration> |