<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <property resource="application.properties"/>
    <property name="PROJECT_NAME" value="${spring.application.name}" />
    <property name="LOG_HOME" value="/data/logs" />
    <!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, -->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <charset>UTF-8</charset>
            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                <pattern>%d %p [%thread] (%file:%line\) - [${PROJECT_NAME:-}, ${eureka.instance.metadataMap.version} , %tid] %m%n  </pattern>
            </layout>
        </encoder>
    </appender>
    <springProfile name="default">
        <logger name="cn.freemud" level="debug" additivity="false">
            <appender-ref ref="STDOUT" />
        </logger>
        <logger name="com.freemud" level="debug" additivity="false">
            <appender-ref ref="STDOUT" />
        </logger>
        <appender name="FREEMUD_DEV_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>${LOG_HOME}/${PROJECT_NAME}/freemud_api_${PROJECT_NAME}-dev.log</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${LOG_HOME}/${PROJECT_NAME}/freemud_api_${PROJECT_NAME}-dev-%d{yyyy-MM-dd}.log</fileNamePattern>
            </rollingPolicy>

            <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
                <charset>UTF-8</charset>
                <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                    <pattern>%d %p [%thread] (%file:%line\) - [${spring.application.name}, %tid] %m%n </pattern>
                </layout>
            </encoder>
        </appender>
        <logger name="cn.freemud" level="debug" additivity="false">
            <appender-ref ref="FREEMUD_DEV_DEBUG"/>
        </logger>
        <logger name="com.freemud" level="debug" additivity="false">
            <appender-ref ref="STDOUT"/>
        </logger>
    </springProfile>

    <springProfile name="mock">
        <logger name="cn.freemud" level="debug" additivity="false">
            <appender-ref ref="STDOUT" />
        </logger>
        <logger name="com.freemud" level="debug" additivity="false">
            <appender-ref ref="STDOUT" />
        </logger>
    </springProfile>

    <springProfile name="qa">
        <logger name="cn.freemud" level="debug" additivity="false">
            <appender-ref ref="STDOUT" />
        </logger>
        <logger name="com.freemud" level="debug" additivity="false">
            <appender-ref ref="STDOUT" />
        </logger>
    </springProfile>


    <springProfile name="dev">
        <appender name="FREEMUD_TEST_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>${LOG_HOME}/${PROJECT_NAME}/freemud_api_${PROJECT_NAME}-test.log</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                <fileNamePattern>${LOG_HOME}/${PROJECT_NAME}/freemud_api-${PROJECT_NAME}-%d{yyyy-MM-dd}.log</fileNamePattern>
            </rollingPolicy>
            <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
                <charset>UTF-8</charset>
                <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                    <pattern>%d %p [%thread] (%file:%line\) - [${spring.application.name}, %tid] %m%n </pattern>
                </layout>
            </encoder>
        </appender>
        <logger name="cn.freemud" level="debug" additivity="false">
            <appender-ref ref="FREEMUD_TEST_DEBUG"/>
        </logger>
        <logger name="com.freemud" level="debug" additivity="false">
            <appender-ref ref="FREEMUD_TEST_DEBUG"/>
        </logger>
    </springProfile>

    <springProfile name="pro">
        <logger name="cn.freemud" level="info" additivity="false">
            <appender-ref ref="STDOUT"/>
        </logger>

        <logger name="com.freemud" level="info" additivity="false">
            <appender-ref ref="STDOUT"/>
        </logger>

    </springProfile>


    <root level="info">
        <appender-ref ref="STDOUT"/>
    </root>

</configuration>