Created
April 2, 2015 15:38
-
-
Save aesteve/e5799c12db2f4028f4bc to your computer and use it in GitHub Desktop.
Logback configuration for rolling files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static ch.qos.logback.classic.Level.* | |
import ch.qos.logback.classic.encoder.PatternLayoutEncoder | |
import ch.qos.logback.core.rolling.RollingFileAppender | |
import ch.qos.logback.core.rolling.TimeBasedRollingPolicy | |
import ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP | |
appender("FILE", RollingFileAppender) { | |
file = "logs/server.log" | |
append = true | |
encoder(PatternLayoutEncoder) { pattern = "%d{HH:mm:ss.SSS} %-5level %logger{60} - %msg%n" } | |
rollingPolicy(TimeBasedRollingPolicy) { | |
fileNamePattern = "logs/server.%d{yyyy-MM-dd}.%i.log" | |
maxHistory = 100 | |
timeBasedFileNamingAndTriggeringPolicy(SizeAndTimeBasedFNATP) { maxFileSize = "10MB" } | |
} | |
} | |
root(INFO, ["FILE"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment