<?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"/>

    <!-- 设置日志输出格式，ConsoleAppender代表输出到控制台 -->
    <appender name="STDOUT_SKYWALKING" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
            <layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
                <pattern>
                    {"level":"%p", "timestamp":"%d", "projectName":"${PROJECT_NAME:-}","grayVersion":"${eureka.instance.metadataMap.version}", "tid":"%tid", "scenarios":"%X{scenarios}","message":%m}%n
                </pattern>
            </layout>
        </encoder>
    </appender>

    <!--用来设置某一个环境/包的日志打印级别，以及指定appender，name: 用来指定受此logger约束的某一个包，level: 用来设置打印级别，addtivity: 是否向上级logger传递打印信息-->
    <springProfile name="mock">
        <logger name="cn.freemud" level="debug" additivity="false">
            <appender-ref ref="STDOUT_SKYWALKING"/>
        </logger>
        <logger name="com.freemud" level="debug" additivity="false">
            <appender-ref ref="STDOUT_SKYWALKING"/>
        </logger>
    </springProfile>

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

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

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

    <springProfile name="pre-release">
        <logger name="cn.freemud" level="info" additivity="false">
            <appender-ref ref="STDOUT_SKYWALKING"/>
        </logger>
        <logger name="com.freemud" level="info" additivity="false">
            <appender-ref ref="STDOUT_SKYWALKING"/>
        </logger>
    </springProfile>

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

    <!-- 从高到地低 OFF 、 FATAL 、 ERROR 、 WARN 、 INFO 、 DEBUG 、 TRACE 、 ALL，日志输出规则 根据当前ROOT 级别，日志输出时，级别高于root默认的级别时会自动输出 -->
    <root level="info">
        <appender-ref ref="STDOUT_SKYWALKING"/>
    </root>

</configuration>







