More information about log back mechanism and configuration

Hi team, I would like to reduce kairosdb traces in log files, then i need to change the configuration in order to have limited log size and wrap around log files. This is my current log configuration file: <?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level [%file:%line] - %msg%n</pattern> </encoder> </appender> <appender name="logfile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>log/kairosdb.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- daily rollover --> <fileNamePattern>log/kairosdb.%d{yyyy-MM-dd}.log</fileNamePattern> <!-- keep 30 days' worth of history --> <maxHistory>30</maxHistory> </rollingPolicy> <encoder> <pattern>%d{MM-dd|HH:mm:ss.SSS} [%thread] %-5level [%file:%line] - %msg%n</pattern> </encoder> </appender> <logger name="com.mchange.v2.c3p0" level="WARN"/> <root level="DEBUG"> <appender-ref ref="stdout"/> <appender-ref ref="logfile"/> </root> </configuration> My requirement is to have 'N' files of maximum size 'S' MB which go in rollover, possibly leaving the first file unchanged. Thanks and regards Ciao Roberto.

Hi Roberto, Your requirement is mentioned in LOGBACK-747 [1]. It is scheduled for the next version of logback. In the mean time, try SizeAndTimeBasedFNATP [2]. It is fairly close to your requirement. It supports deletion of old archive files but by period and not total size. HTH, -- Ceki [1] http://jira.qos.ch/browse/LOGBACK-747 [2] http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedFNATP On 2/29/2016 15:26, Roberto Pecoraro wrote:
Hi team,
I would like to reduce kairosdb traces in log files, then i need to change the configuration in order to have limited log size and wrap around log files.
This is my current log configuration file:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level [%file:%line] - %msg%n</pattern> </encoder> </appender> <appender name="logfile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>log/kairosdb.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- daily rollover --> <fileNamePattern>log/kairosdb.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- keep 30 days' worth of history --> <maxHistory>30</maxHistory> </rollingPolicy> <encoder> <pattern>%d{MM-dd|HH:mm:ss.SSS} [%thread] %-5level [%file:%line] - %msg%n</pattern> </encoder> </appender>
<logger name="com.mchange.v2.c3p0" level="WARN"/>
<root level="DEBUG"> <appender-ref ref="stdout"/> <appender-ref ref="logfile"/> </root> </configuration>
My requirement is to have 'N' files of maximum size 'S' MB which go in rollover, possibly leaving the first file unchanged.
Thanks and regards
Ciao Roberto.
_______________________________________________ logback-user mailing list logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
participants (2)
-
Ceki Gulcu
-
Roberto Pecoraro