Add runtime log rolling.
- Default template updated to trigger log rolling,
when the file exceeds 100MB.
${LOGBASE}.%i.log.gz
This may relax ONOS-1336 to some extent.
- Added std{out,err} and gziped log created by rolling to
files rotated on each ONOS startup.
Change-Id: Ic0e1e7cd26eee6be6b53ea9e5faac6aff1e4fa55
diff --git a/conf/template/logback.xml.template b/conf/template/logback.xml.template
index aef06ed..e23821b 100644
--- a/conf/template/logback.xml.template
+++ b/conf/template/logback.xml.template
@@ -1,16 +1,24 @@
<configuration scan="true" scanPeriod="1 minutes" debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-<encoder>
-<pattern>%level [%logger:%thread] %msg%n</pattern>
-</encoder>
+ <encoder>
+ <pattern>%level [%logger:%thread] %msg%n</pattern>
+ </encoder>
</appender>
-<appender name="FILE" class="ch.qos.logback.core.FileAppender">
-<file>__FILENAME__</file>
-<encoder>
-<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
-<immediateFlush>true</immediateFlush>
-</encoder>
+<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>__FILENAME__</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>__ROLLING_PATTERN__</fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+ <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>100MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
+ <immediateFlush>true</immediateFlush>
+ </encoder>
</appender>
<logger name="org" level="WARN"/>
@@ -19,6 +27,6 @@
<logger name="com.hazelcast" level="INFO"/>
<root level="DEBUG">
-<appender-ref ref="FILE" />
+ <appender-ref ref="FILE" />
</root>
-</configuration>
\ No newline at end of file
+</configuration>