<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
	<!-- 从application.yml中获取参数值 -->
	<springProperty scope="context" name="log.path" source="logback.filepath" defaultValue="target/logs"/>
	
    <!-- 日志输出格式 -->
	<property name="log.pattern" value="%date [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />

    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
    </appender>
    
    <!-- 日志输出 -->
	<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
	    <file>${log.path}/info.log</file>
        <!-- 循环政策：基于时间创建日志文件 -->
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 日志文件名格式 -->
			<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
			<!-- 日志最大的历史 30天 -->
			<maxHistory>30</maxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>${log.pattern}</pattern>
		</encoder>
	</appender>
	
    <root level="info">
    	<appender-ref ref="stdout"/>
    	<appender-ref ref="file" />
    </root>
    
    <logger name="com.platomix.userprofile.mapper" level="DEBUG"/>
    
</configuration>