Last active
December 7, 2018 10:15
-
-
Save milovtim/c19ebd15f82b9d2b4defd7985d72874e to your computer and use it in GitHub Desktop.
LOG_PATH -- env/local var of log files location, FILE_LOG_PATTERN -- env/local val with pattern
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
def tmpl = { | |
""" | |
<appender name="${it.toUpperCase()}_FILE" | |
additivity="false" | |
class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
<file>\${LOG_PATH}/${it.toLowerCase()}.log</file> | |
<encoder><pattern>\${FILE_LOG_PATTERN}</pattern></encoder> | |
<append>true</append> | |
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
<fileNamePattern>\${LOG_PATH}/old/${it.toLowerCase()}_%d{yyyy-MM-dd, aux}/${it.toLowerCase()}.%d{yyyy-MM-dd-HH}.gz</fileNamePattern> | |
</rollingPolicy> | |
</appender> | |
""" | |
} | |
['common', 'spring', 'app'].each { | |
println tmpl(it) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple rolling file appenders with one hour rolling policy. Archived logs are put to daily named folders.