long startTime=System.currentTimeMillis();
logger.error("test error!");
long endTime=System.currentTimeMillis();
logger.debug("costTime:[{}ms]",endTime-startTime);
``<!--logback.xml-->
<appender name="debugAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.filePath}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBaseRollingPolicy">
<fileNamePattern>
${log.filePath}/debug/debug.%d{yyyy-MM-dd}.log.gz
</fileNamePattern>
<maxHistory>${log.maxHistory}</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!--****-->
` <logger name="com.iflytek" level="${log.level}" additivity="true">
<appender-ref ref="debugAppender"/>
<appender-ref ref="infoAppender"/>
<appender-ref ref="errorAppender"/>
</logger>
<root level="info">
<appender-ref ref="consoleAppender"/>
</root>
为什么控制台打印不出debug的日志,我都写了的?谢谢!
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程