Created
September 23, 2015 04:55
-
-
Save aaronzirbes/d54a74a3da0f26edab77 to your computer and use it in GitHub Desktop.
Logback Groovy Config
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.DEBUG | |
import static ch.qos.logback.classic.Level.INFO | |
final String APP = 'my-app' | |
final String LOG_PATH = "/var/log/${APP}" | |
include 'org/springframework/boot/logging/logback/base.xml' | |
appender('STDOUT', ConsoleAppender) { | |
encoder(PatternLayoutEncoder) { | |
//pattern = '%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n' | |
pattern = '%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%t] %msg%n' | |
} | |
} | |
appender("FILE", RollingFileAppender) { | |
String outputLog = "${LOG_PATH}/${APP}.log" | |
file = outputLog | |
append = true | |
encoder(PatternLayoutEncoder) { | |
//pattern = '%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n' | |
pattern = '%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%t] %msg%n' | |
} | |
rollingPolicy(FixedWindowRollingPolicy) { | |
fileNamePattern = "${LOG_PATH}/${APP}.%i.log.gz" | |
minIndex = 1 | |
maxIndex = 9 | |
} | |
triggeringPolicy(SizeBasedTriggeringPolicy) { | |
maxFileSize = '5MB' | |
} | |
} | |
//logger("com.mnclimbingcoop", DEBUG, ['STDOUT'], true) | |
root(INFO, ['FILE', 'STDOUT']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment