增加一行<logger>,如下图,原理请参考,
快速入门logback(2)
快速入门logback(1)
<?xml version="1.0" encoding="UTF-8"?> <configuration> <!-- https://github.com/spring-projects/spring-boot/blob/v1.5.13.RELEASE/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml --> <include resource="org/springframework/boot/logging/logback/defaults.xml" /> <property name="APP_NAME" value="ascp-quickplan-service" /> <property name="LOG_PATH" value="${user.home}/${APP_NAME}/logs" /> <property name="LOG_FILE" value="${LOG_PATH}/application.log" /> <appender name="APPLICATION" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_FILE}</file> <encoder> <pattern>${FILE_LOG_PATTERN}</pattern> </encoder> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i.log</fileNamePattern> <maxHistory>7</maxHistory> <maxFileSize>50MB</maxFileSize> <totalSizeCap>20GB</totalSizeCap> </rollingPolicy> </appender> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>${CONSOLE_LOG_PATTERN}</pattern> <charset>utf8</charset> </encoder> </appender> ------------增加这一行-------------- <logger name="xxxx.ApplicationConfigDAO" level="DEBUG" /> <root level="INFO"> <appender-ref ref="CONSOLE" /> <appender-ref ref="APPLICATION" /> </root> </configuration>