import static ch.qos.logback.classic.Level.INFO
import ch.qos.logback.classic.encoder.PatternLayoutEncoder
import ch.qos.logback.core.rolling.FixedWindowRollingPolicy
import ch.qos.logback.core.rolling.RollingFileAppender
import ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy
import ch.qos.logback.core.status.OnConsoleStatusListener
// Print out the Logback configuration information at startup.
statusListener OnConsoleStatusListener
def BASE_DIR = System.getProperty('catalina.base') ?: System.getProperty('user.dir') (1)
appender("WEBAPP", RollingFileAppender) {
file = "${BASE_DIR}/logs/application.log"
encoder(PatternLayoutEncoder) {
pattern = "%-50(%date{ISO8601} [%thread]) %-5level %logger{50} - %msg%n%rEx"
}
triggeringPolicy(SizeBasedTriggeringPolicy) {
maxFileSize = '10MB'
}
rollingPolicy(FixedWindowRollingPolicy) {
fileNamePattern = "${BASE_DIR}/logs/application-%d{yyyyMMdd_hhmmss}.%i.gz"
maxIndex = 10
}
}
root(INFO, ["WEBAPP"])