1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration debug="false">
- <!--定义日志文件的存储地址 -->
- <property name="LOG_HOME" value="../logs" />
- <!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
- <!-- 控制台输出 -->
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符
- <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
- <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern>
- </encoder>
- </appender>
- <!-- 按照每天生成日志文件 -->
- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
- <!--日志文件输出的文件名 -->
- <FileNamePattern>${LOG_HOME}/jeecgboot-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
- <!--日志文件保留天数 -->
- <MaxHistory>30</MaxHistory>
- <maxFileSize>10MB</maxFileSize>
- </rollingPolicy>
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
- <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>
- </encoder>
- </appender>
- <!-- 生成 error html格式日志开始 -->
- <appender name="HTML" class="ch.qos.logback.core.FileAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <!--设置日志级别,过滤掉info日志,只输入error日志-->
- <level>ERROR</level>
- </filter>
- <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
- <layout class="ch.qos.logback.classic.html.HTMLLayout">
- <pattern>%p%d%msg%M%F{32}%L</pattern>
- </layout>
- </encoder>
- <file>${LOG_HOME}/error-log.html</file>
- </appender>
- <!-- 生成 error html格式日志结束 -->
- <!-- 每天生成一个html格式的日志开始 -->
- <appender name="FILE_HTML" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
- <!--日志文件输出的文件名 -->
- <FileNamePattern>${LOG_HOME}/jeecgboot-%d{yyyy-MM-dd}.%i.html</FileNamePattern>
- <!--日志文件保留天数 -->
- <MaxHistory>30</MaxHistory>
- <MaxFileSize>10MB</MaxFileSize>
- </rollingPolicy>
- <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
- <layout class="ch.qos.logback.classic.html.HTMLLayout">
- <pattern>%p%d%msg%M%F{32}%L</pattern>
- </layout>
- </encoder>
- </appender>
- <!-- 每天生成一个html格式的日志结束 -->
- <!--myibatis log configure -->
- <logger name="com.apache.ibatis" level="TRACE" />
- <logger name="java.sql.Connection" level="DEBUG" />
- <logger name="java.sql.Statement" level="DEBUG" />
- <logger name="java.sql.PreparedStatement" level="DEBUG" />
- <!-- 日志输出级别 -->
- <root level="INFO">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="FILE" />
- <appender-ref ref="HTML" />
- <appender-ref ref="FILE_HTML" />
- </root>
- </configuration>
|