diff options
author | Jenkins CI <ci@sonarsource.com> | 2014-09-24 21:30:43 +0200 |
---|---|---|
committer | Jenkins CI <ci@sonarsource.com> | 2014-09-24 21:30:43 +0200 |
commit | a813b87b35008962ce53b8629804c86f236fb8ab (patch) | |
tree | f445fffd4c11f5d6f73fa902da1e679fc2096734 /sonar-application | |
parent | 582c3f65221093d7bfbd1972da17fc2f0ee3b7b1 (diff) | |
parent | 85c037c87a728edbefc0fd417d6cb89cab246e44 (diff) | |
download | sonarqube-a813b87b35008962ce53b8629804c86f236fb8ab.tar.gz sonarqube-a813b87b35008962ce53b8629804c86f236fb8ab.zip |
Automatic merge from branch-4.5
* origin/branch-4.5:
SONAR-5621 Merge server log files into a single one
SONAR-5621 merge log files
Update description of "sonar.technicalDebt.ratingGrid"
Diffstat (limited to 'sonar-application')
-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 | 33 |
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> |