mybatis logback打印sql

时间:2024-06-08 19:37:02
<?xml version="1.0" encoding="UTF-8" ?><configuration>  <contextName>acfun-service.spread-provider</contextName>  <!-- 声明变量 --> <substitutionProperty name="log.base" value="./logs/acfun-service.vote-provider"/>

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">    <layout class="ch.qos.logback.classic.PatternLayout">      <pattern>%d{yy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>    </layout>  </appender>

  <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">      <fileNamePattern>${log.base}.%d{yyyy-MM-dd}.log</fileNamePattern>      <maxHistory>30</maxHistory>    </rollingPolicy>    <encoder>      <pattern>%d{yy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>      <charset>utf-8</charset>    </encoder>  </appender>  <!--打印sql开启--> <logger name="com.xxx.service.vote.dao" level="debug" additivity="true">    <appender-ref ref="console" />  </logger>  <!--打印sql结束-->

 <root level="DEBUG">    <appender-ref ref="STDOUT"/>    <appender-ref ref="FILE"/>  </root>

</configuration>