def log_home = System.getProperty("LOG_HOME");
def log_file = "xxlog";
def level = DEBUG;
if(log_home == null){
if("Windows" == os){
log_home = "d:/logs";
}else{
log_home = "/home/web/logs";
}
}
println "log home ==> ${log_home}"
println "log level ==> ${level}"
appender("FILE", RollingFileAppender) {
append = true;
encoder(PatternLayoutEncoder) {
pattern = "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n"
}
rollingPolicy(TimeBasedRollingPolicy){
maxHistory = 30;
fileNamePattern = "${log_home}/${log_file}.%d{yyyy-MM-dd}.log";
}
triggeringPolicy(SizeBasedTriggeringPolicy){
maxFileSize = "50mb";
}
}
appender("STDOUT", ConsoleAppender) {
encoder(PatternLayoutEncoder) {
pattern = "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n"
}
}
logger("com.xxx", DEBUG)
logger("org.springframework", INFO)
root(DEBUG, ["STDOUT","FILE"])
logback groovy配置
最新推荐文章于 2023-01-08 16:58:35 发布