easyj.logging.logback.appenders.file-appender.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <included> <if condition='"true".equalsIgnoreCase(property("FILE_ENABLED"))'> <then> <!-- file-appender properties --> <springProperty name="LOG_FILE_PATH" source="logging.file.path" defaultValue="${user.home}/logs/"/> <springProperty name="FILE_NAME_PRE" source="easyj.logging.logback.file-appender.file-name-prefix" defaultValue="spring"/> <property name="FILE_LOG_PATTERN" value="${FILE_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx2}}"/> <property name="FILE_LOG_CHARSET" value="${FILE_LOG_CHARSET:-UTF-8}"/> <!-- sub-file-appenders enabled --> <springProperty name="FILE_ALL_ENABLED" source="easyj.logging.logback.file-appender.all-appender.enabled" defaultValue="true"/> <springProperty name="FILE_TRACE_ENABLED" source="easyj.logging.logback.file-appender.trace-appender.enabled" defaultValue="false"/> <springProperty name="FILE_DEBUG_ENABLED" source="easyj.logging.logback.file-appender.debug-appender.enabled" defaultValue="false"/> <springProperty name="FILE_INFO_ENABLED" source="easyj.logging.logback.file-appender.info-appender.enabled" defaultValue="false"/> <springProperty name="FILE_WARN_ENABLED" source="easyj.logging.logback.file-appender.warn-appender.enabled" defaultValue="true"/> <springProperty name="FILE_ERROR_ENABLED" source="easyj.logging.logback.file-appender.error-appender.enabled" defaultValue="true"/> <springProperty name="FILE_FATAL_ENABLED" source="easyj.logging.logback.file-appender.fatal-appender.enabled" defaultValue="false"/> <!-- all-appender --> <if condition='"true".equalsIgnoreCase(property("FILE_ALL_ENABLED"))'> <then> <appender name="FILE_ALL" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_FILE_PATH}/${FILE_NAME_PRE}.${SERVER_PORT}.all.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${LOG_FILE_PATH}/history/${FILE_NAME_PRE}.${SERVER_PORT}.all.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-true}</cleanHistoryOnStart> <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-1GB}</maxFileSize> <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-7GB}</totalSizeCap> <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-7}</maxHistory> </rollingPolicy> <encoder> <pattern>${FILE_LOG_PATTERN}</pattern> <charset>${FILE_LOG_CHARSET}</charset> </encoder> </appender> </then> </if> <!-- trace-appender --> <if condition='"true".equalsIgnoreCase(property("FILE_TRACE_ENABLED"))'> <then> <appender name="FILE_TRACE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>TRACE</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <file>${LOG_FILE_PATH}/${FILE_NAME_PRE}.${SERVER_PORT}.trace.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${LOG_FILE_PATH}/history/${FILE_NAME_PRE}.${SERVER_PORT}.trace.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-true}</cleanHistoryOnStart> <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-1GB}</maxFileSize> <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-7GB}</totalSizeCap> <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-1}</maxHistory> </rollingPolicy> <encoder> <pattern>${FILE_LOG_PATTERN}</pattern> <charset>${FILE_LOG_CHARSET}</charset> </encoder> </appender> </then> </if> <!-- debug-appender --> <if condition='"true".equalsIgnoreCase(property("FILE_DEBUG_ENABLED"))'> <then> <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>DEBUG</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <file>${LOG_FILE_PATH}/${FILE_NAME_PRE}.${SERVER_PORT}.debug.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${LOG_FILE_PATH}/history/${FILE_NAME_PRE}.${SERVER_PORT}.debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-true}</cleanHistoryOnStart> <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-1GB}</maxFileSize> <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-7GB}</totalSizeCap> <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-3}</maxHistory> </rollingPolicy> <encoder> <pattern>${FILE_LOG_PATTERN}</pattern> <charset>${FILE_LOG_CHARSET}</charset> </encoder> </appender> </then> </if> <!-- info-appender --> <if condition='"true".equalsIgnoreCase(property("FILE_INFO_ENABLED"))'> <then> <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <file>${LOG_FILE_PATH}/${FILE_NAME_PRE}.${SERVER_PORT}.info.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${LOG_FILE_PATH}/history/${FILE_NAME_PRE}.${SERVER_PORT}.info.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-true}</cleanHistoryOnStart> <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-1GB}</maxFileSize> <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-7GB}</totalSizeCap> <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-7}</maxHistory> </rollingPolicy> <encoder> <pattern>${FILE_LOG_PATTERN}</pattern> <charset>${FILE_LOG_CHARSET}</charset> </encoder> </appender> </then> </if> <!-- warn-appender --> <if condition='"true".equalsIgnoreCase(property("FILE_WARN_ENABLED"))'> <then> <appender name="FILE_WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>WARN</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <file>${LOG_FILE_PATH}/${FILE_NAME_PRE}.${SERVER_PORT}.warn.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${LOG_FILE_PATH}/history/${FILE_NAME_PRE}.${SERVER_PORT}.warn.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-true}</cleanHistoryOnStart> <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-1GB}</maxFileSize> <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-7GB}</totalSizeCap> <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-15}</maxHistory> </rollingPolicy> <encoder> <pattern>${FILE_LOG_PATTERN}</pattern> <charset>${FILE_LOG_CHARSET}</charset> </encoder> </appender> </then> </if> <!-- error-appender --> <if condition='"true".equalsIgnoreCase(property("FILE_ERROR_ENABLED"))'> <then> <appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <file>${LOG_FILE_PATH}/${FILE_NAME_PRE}.${SERVER_PORT}.error.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${LOG_FILE_PATH}/history/${FILE_NAME_PRE}.${SERVER_PORT}.error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-true}</cleanHistoryOnStart> <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-1GB}</maxFileSize> <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-7GB}</totalSizeCap> <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory> </rollingPolicy> <encoder> <pattern>${FILE_LOG_PATTERN}</pattern> <charset>${FILE_LOG_CHARSET}</charset> </encoder> </appender> </then> </if> <!-- fatal-appender --> <if condition='"true".equalsIgnoreCase(property("FILE_FATAL_ENABLED"))'> <then> <appender name="FILE_FATAL" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>FATAL</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <file>${LOG_FILE_PATH}/${FILE_NAME_PRE}.${SERVER_PORT}.fatal.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${LOG_FILE_PATH}/history/${FILE_NAME_PRE}.${SERVER_PORT}.fatal.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern> <cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-true}</cleanHistoryOnStart> <maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-1GB}</maxFileSize> <totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-7GB}</totalSizeCap> <maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory> </rollingPolicy> <encoder> <pattern>${FILE_LOG_PATTERN}</pattern> <charset>${FILE_LOG_CHARSET}</charset> </encoder> </appender> </then> </if> </then> </if> </included>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy