logback-模板
<?xml version="1.0" encoding="UTF-8"?> <configuration debug="false"> <property name="PROJECT" value="mysb1" /> <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <property name="ROOT" value="d:/logs/${PROJECT}/" /> <!--日志文件最大的大小--> <property name="FILESIZE" value="50MB" /> <!--日志文件保留天数--> <property name="MAXHISTORY" value="100" /> <timestamp key="DATETIME" datePattern="yyyy-MM-dd HH:mm:ss" /> <!-- 控制台打印 --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> </appender> <!-- ERROR 输入到文件,按日期和文件大小 --> <!-- RollingFileAppender 按照每天生成日志文件 --> <appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!--日志文件输出的文件名--> <fileNamePattern>${ROOT}%d/error.%i.log</fileNamePattern> <!--日志文件保留天数--> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <!--日志文件最大的大小--> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- WARN 输入到文件,按日期和文件大小 --> <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>WARN</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/warn.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- INFO 输入到文件,按日期和文件大小 --> <appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/info.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- DEBUG 输入到文件,按日期和文件大小 --> <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>DEBUG</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/debug.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- TRACE 输入到文件,按日期和文件大小 --> <appender name="TRACE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>TRACE</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/trace.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- SQL相关日志输出--> <logger name="org.apache.ibatis" level="INFO" additivity="false" /> <logger name="org.mybatis.spring" level="INFO" additivity="false" /> <logger name="com.github.miemiedev.mybatis.paginator" level="INFO" additivity="false" /> <!-- Logger 根目录 --> <!-- 日志输出级别 --> <root level="DEBUG"> <appender-ref ref="STDOUT" /> <appender-ref ref="DEBUG" /> <appender-ref ref="ERROR" /> <appender-ref ref="WARN" /> <appender-ref ref="INFO" /> <appender-ref ref="TRACE" /> </root> </configuration><?xml version="1.0" encoding="UTF-8"?> <configuration debug="false"> <property name="PROJECT" value="mysb1" /> <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <property name="ROOT" value="d:/logs/${PROJECT}/" /> <!--日志文件最大的大小--> <property name="FILESIZE" value="50MB" /> <!--日志文件保留天数--> <property name="MAXHISTORY" value="100" /> <timestamp key="DATETIME" datePattern="yyyy-MM-dd HH:mm:ss" /> <!-- 控制台打印 --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> </appender> <!-- ERROR 输入到文件,按日期和文件大小 --> <!-- RollingFileAppender 按照每天生成日志文件 --> <appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!--日志文件输出的文件名--> <fileNamePattern>${ROOT}%d/error.%i.log</fileNamePattern> <!--日志文件保留天数--> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <!--日志文件最大的大小--> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- WARN 输入到文件,按日期和文件大小 --> <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>WARN</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/warn.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- INFO 输入到文件,按日期和文件大小 --> <appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/info.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- DEBUG 输入到文件,按日期和文件大小 --> <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>DEBUG</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/debug.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- TRACE 输入到文件,按日期和文件大小 --> <appender name="TRACE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>TRACE</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/trace.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- SQL相关日志输出--> <logger name="org.apache.ibatis" level="INFO" additivity="false" /> <logger name="org.mybatis.spring" level="INFO" additivity="false" /> <logger name="com.github.miemiedev.mybatis.paginator" level="INFO" additivity="false" /> <!-- Logger 根目录 --> <!-- 日志输出级别 --> <root level="DEBUG"> <appender-ref ref="STDOUT" /> <appender-ref ref="DEBUG" /> <appender-ref ref="ERROR" /> <appender-ref ref="WARN" /> <appender-ref ref="INFO" /> <appender-ref ref="TRACE" /> </root> </configuration>
<?xml version="1.0" encoding="UTF-8"?><configuration debug="false">
<property name="PROJECT" value="mysb1" /> <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <property name="ROOT" value="d:/logs/${PROJECT}/" /> <!--日志文件最大的大小--> <property name="FILESIZE" value="50MB" /> <!--日志文件保留天数--> <property name="MAXHISTORY" value="100" /> <timestamp key="DATETIME" datePattern="yyyy-MM-dd HH:mm:ss" /> <!-- 控制台打印 --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> </appender> <!-- ERROR 输入到文件,按日期和文件大小 --> <!-- RollingFileAppender 按照每天生成日志文件 --> <appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!--日志文件输出的文件名--> <fileNamePattern>${ROOT}%d/error.%i.log</fileNamePattern> <!--日志文件保留天数--> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <!--日志文件最大的大小--> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- WARN 输入到文件,按日期和文件大小 --> <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>WARN</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/warn.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- INFO 输入到文件,按日期和文件大小 --> <appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/info.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- DEBUG 输入到文件,按日期和文件大小 --> <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>DEBUG</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/debug.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- TRACE 输入到文件,按日期和文件大小 --> <appender name="TRACE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>TRACE</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/trace.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- SQL相关日志输出--> <logger name="org.apache.ibatis" level="INFO" additivity="false" /> <logger name="org.mybatis.spring" level="INFO" additivity="false" /> <logger name="com.github.miemiedev.mybatis.paginator" level="INFO" additivity="false" /> <!-- Logger 根目录 --> <!-- 日志输出级别 --> <root level="DEBUG"> <appender-ref ref="STDOUT" /> <appender-ref ref="DEBUG" /> <appender-ref ref="ERROR" /> <appender-ref ref="WARN" /> <appender-ref ref="INFO" /> <appender-ref ref="TRACE" /> </root></configuration><?xml version="1.0" encoding="UTF-8"?><configuration debug="false">
<property name="PROJECT" value="mysb1" /> <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <property name="ROOT" value="d:/logs/${PROJECT}/" /> <!--日志文件最大的大小--> <property name="FILESIZE" value="50MB" /> <!--日志文件保留天数--> <property name="MAXHISTORY" value="100" /> <timestamp key="DATETIME" datePattern="yyyy-MM-dd HH:mm:ss" /> <!-- 控制台打印 --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> </appender> <!-- ERROR 输入到文件,按日期和文件大小 --> <!-- RollingFileAppender 按照每天生成日志文件 --> <appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符--> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!--日志文件输出的文件名--> <fileNamePattern>${ROOT}%d/error.%i.log</fileNamePattern> <!--日志文件保留天数--> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <!--日志文件最大的大小--> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- WARN 输入到文件,按日期和文件大小 --> <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>WARN</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/warn.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- INFO 输入到文件,按日期和文件大小 --> <appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/info.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- DEBUG 输入到文件,按日期和文件大小 --> <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>DEBUG</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/debug.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- TRACE 输入到文件,按日期和文件大小 --> <appender name="TRACE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <encoder charset="utf-8"> <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n </pattern> </encoder> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>TRACE</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${ROOT}%d/trace.%i.log</fileNamePattern> <maxHistory>${MAXHISTORY}</maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILESIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <!-- SQL相关日志输出--> <logger name="org.apache.ibatis" level="INFO" additivity="false" /> <logger name="org.mybatis.spring" level="INFO" additivity="false" /> <logger name="com.github.miemiedev.mybatis.paginator" level="INFO" additivity="false" /> <!-- Logger 根目录 --> <!-- 日志输出级别 --> <root level="DEBUG"> <appender-ref ref="STDOUT" /> <appender-ref ref="DEBUG" /> <appender-ref ref="ERROR" /> <appender-ref ref="WARN" /> <appender-ref ref="INFO" /> <appender-ref ref="TRACE" /> </root></configuration>