<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2021 DataCanvas
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<configuration scan="true" scanPeriod="60 seconds" debug="false">
    <!-- Define global parameter constants -->
    <!-- Log level all<trace<debug<info<warn<error<off -->
    <!-- Control the Executor module public log level -->
    <property name="log.level" value="info"/>
    <!-- Control the RPC module public log level -->
    <property name="rpcLog.level" value="info"/>
    <!-- Maximum time for log storage -->
    <property name="log.maxHistory" value="7"/>
    <!-- Log storage location -->
    <property name="log.filePath" value="${user.dir}"/>
    <!-- Display format of log -->
    <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}:%line] - %msg%n"/>
    <!-- Maximum size of log file -->
    <property name="log.file.max" value="256MB"/>
    <!-- Maximum total size of log files -->
    <property name="log.file.total" value="5GB"/>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${log.pattern}</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="Executor" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/executor.log</file>
        <!-- Log rolling strategy -->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/executor.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}:%line] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="Calcite" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/calcite.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/calcite.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{stmtId}] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="Job" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/job.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/job.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="Txn" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/txn.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/txn.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{txnId}] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="Ddl" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/ddl.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/ddl.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{stmtId}] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="Sql" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/sql.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/sql.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%X{stmtId}] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="SlowQuery" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/slow_query.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/slow_query.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="Metric" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/metric.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/metric.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="Audit" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/audit.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/audit.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>1024MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>1</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="BackUp" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/backup.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/backup.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>1024MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>1</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%-5level] %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="StoreProxy" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/storeProxy.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/storeProxy.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="META_EVENT" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/metaEvent.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/metaEvent.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="STORE_RPC" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/storeRpc.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/storeRpc.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}:%line] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>${rpcLog.level}</level>
        </filter>
    </appender>
    <appender name="INDEX_RPC" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/indexRpc.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/indexRpc.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}:%line] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>${rpcLog.level}</level>
        </filter>
    </appender>

    <appender name="DOCUMENT_RPC" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/documentRpc.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/documentRpc.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}:%line] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>${rpcLog.level}</level>
        </filter>
    </appender>

    <appender name="COORDINATOR_RPC" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/coordinatorRpc.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/coordinatorRpc.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}:%line] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>${rpcLog.level}</level>
        </filter>
    </appender>
    <appender name="META_RPC" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/metaRpc.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/metaRpc.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}:%line] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>${rpcLog.level}</level>
        </filter>
    </appender>
    <appender name="VERSION_RPC" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/versionRpc.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/versionRpc.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}:%line] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>${rpcLog.level}</level>
        </filter>
    </appender>

    <appender name="TXN_RPC" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.filePath}/log/txnRpc.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.filePath}/log/%d{yyyy-MM-dd}/txnRpc.%d{yyyyMMdd}.%i.log.gz</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>${log.file.max}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>${log.maxHistory}</maxHistory>
            <totalSizeCap>${log.file.total}</totalSizeCap>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level [%logger{36}:%line] - %msg%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>${rpcLog.level}</level>
        </filter>
    </appender>

    <!-- The logger tag is used to bind to the appender and
    tell logback which package (name attribute) log information needs to be recorded -->
    <!--logger will inherit the root tag. After adding the additivity="true" attribute,
    the level in the root tag will be overwritten by the logger's level-->
    <appender name="ASYNC-Calcite" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="Calcite" />
    </appender>
    <logger name="io.dingodb.driver" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Calcite"/>
    </logger>
    <logger name="io.dingodb.calcite" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Calcite"/>
    </logger>

    <appender name="ASYNC-Txn" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="Txn" />
    </appender>

    <logger name="io.dingodb.exec.transaction" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Txn"/>
    </logger>
    <logger name="io.dingodb.transaction" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Txn"/>
    </logger>
    <logger name="io.dingodb.store.proxy.service.TransactionStoreInstance" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Txn"/>
    </logger>

    <appender name="ASYNC-Job" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="Job" />
    </appender>
    <logger name="io.dingodb.exec" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Job"/>
    </logger>

    <appender name="ASYNC-Executor" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="Executor" />
    </appender>
    <logger name="io.dingodb" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Executor"/>
    </logger>

    <appender name="ASYNC-Ddl" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="Ddl" />
    </appender>
    <logger name="io.dingodb.calcite.DingoDdlExecutor" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Ddl"/>
    </logger>
    <logger name="io.dingodb.server.executor.ddl" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Ddl"/>
    </logger>
    <logger name="io.dingodb.calcite.ddl" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Ddl"/>
    </logger>
    <logger name="io.dingodb.store.service.SchemaSyncerService" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Ddl"/>
    </logger>
    <logger name="io.dingodb.server.executor.schedule.LoadInfoSchemaTask" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Ddl"/>
    </logger>
    <logger name="io.dingodb.meta.entity.InfoCache" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Ddl"/>
    </logger>
    <logger name="io.dingodb.server.executor.schedule.MetaLockCheckHandler" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Ddl"/>
    </logger>
    <logger name="io.dingodb.store.proxy.ddl.DdlHandler" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Ddl"/>
    </logger>

    <appender name="ASYNC-Sql" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="Sql" />
    </appender>
    <logger name="io.dingodb.common.log.SqlLogUtils" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Sql"/>
    </logger>

    <appender name="ASYNC-SlowQuery" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="SlowQuery" />
    </appender>
    <logger name="io.dingodb.common.profile.StmtSummaryMap" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-SlowQuery"/>
    </logger>

    <appender name="ASYNC-Metric" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="Metric" />
    </appender>
    <logger name="metrics" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Metric"/>
    </logger>

    <appender name="ASYNC-Audit" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="Audit" />
    </appender>
    <logger name="io.dingodb.common.log.AuditLogUtils" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-Audit"/>
    </logger>

    <appender name="ASYNC-BackUp" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="BackUp" />
    </appender>
    <logger name="io.dingodb.common.log.BackUpLogUtils" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-BackUp"/>
    </logger>

    <appender name="ASYNC-StoreProxy" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="StoreProxy" />
    </appender>
    <logger name="io.dingodb.store" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-StoreProxy"/>
    </logger>

    <appender name="ASYNC-META_EVENT" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="META_EVENT" />
    </appender>
    <logger name="io.dingodb.store.proxy.meta.MetaCache" level="${log.level}" additivity="false">
        <appender-ref ref="ASYNC-META_EVENT"/>
    </logger>

    <!-- Control RPC module log -->
    <!--Phase, RAfter is the stage name, supports all stages that can be monitored-->
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$RAfter" level="${rpcLog.level}"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$RBefore" level="${rpcLog.level}"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$RError" level="${rpcLog.level}"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$Before" level="off"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$After" level="off"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$OnErrRes" level="${rpcLog.level}"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$OnRetry" level="${rpcLog.level}"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$OnIgnore" level="${rpcLog.level}"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$OnFailed" level="${rpcLog.level}"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$OnException" level="${rpcLog.level}"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$OnThrow" level="${rpcLog.level}"/>
    <logger name="io.dingodb.sdk.service.ServiceCallCycles$OnNonConnection" level="${rpcLog.level}"/>

    <appender name="ASYNC-STORE_RPC" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="STORE_RPC" />
    </appender>
    <!--Only write the package name of the service, not the interface name, and it will take effect on all interfaces of the service-->
    <logger name="io.dingodb.sdk.service.desc.store" level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$KvGet" level="off" additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$KvScanBegin" level="off" additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$KvScanContinue" level="off" additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$KvScanRelease" level="off" additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$KvPutIfAbsent" level="off" additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$KvScanBeginV2" level="off" additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$KvScanContinueV2" level="off" additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$KvScanReleaseV2" level="off" additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnHeartbeat" level="off"  additivity="false">
        <appender-ref ref="ASYNC-STORE_RPC"/>
    </logger>

    <appender name="ASYNC-INDEX_RPC" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="INDEX_RPC" />
    </appender>
    <logger name="io.dingodb.sdk.service.desc.index" level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-INDEX_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.index.IndexServiceDescriptors$TxnScanLock" level="off" additivity="false">
        <appender-ref ref="ASYNC-INDEX_RPC"/>
    </logger>

    <appender name="ASYNC-DOCUMENT_RPC" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="DOCUMENT_RPC" />
    </appender>
    <logger name="io.dingodb.sdk.service.desc.document" level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-DOCUMENT_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.document.DocumentServiceDescriptors$TxnScanLock" level="off" additivity="false">
        <appender-ref ref="ASYNC-DOCUMENT_RPC"/>
    </logger>

    <appender name="ASYNC-META_RPC" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="META_RPC" />
    </appender>
    <logger name="io.dingodb.sdk.service.desc.meta" level="off" additivity="false">
        <appender-ref ref="ASYNC-META_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.meta.MetaServiceDescriptors$TsoService" level="off"/>

    <appender name="ASYNC-COORDINATOR_RPC" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="COORDINATOR_RPC" />
    </appender>
    <logger name="io.dingodb.sdk.service.desc.coordinator" level="off" additivity="false">
        <appender-ref ref="ASYNC-COORDINATOR_RPC"/>
    </logger>

    <appender name="ASYNC-VERSION_RPC" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="VERSION_RPC" />
    </appender>
    <logger name="io.dingodb.sdk.service.desc.version" level="off" additivity="false">
        <appender-ref ref="ASYNC-VERSION_RPC"/>
    </logger>
    <logger name="io.dingodb.sdk.service.desc.version.VersionServiceDescriptors$LeaseRenew" level="off"/>

    <appender name="ASYNC-TXN_RPC" class="ch.qos.logback.classic.AsyncAppender">
        <includeCallerData>true</includeCallerData>
        <discardingThreshold>0</discardingThreshold>
        <queueSize>512</queueSize>
        <appender-ref ref="TXN_RPC" />
    </appender>
    <!--The interface StoreServiceDescriptors is the service where the interface is located, and TxnCommit is the interface name-->
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnCommit" level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnScan"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnPrewrite"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnCheckTxnStatus"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnPessimisticLock"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnPessimisticRollback"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnResolveLock"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnBatchRollback"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnScanLock"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnDeleteRange"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnBatchGet"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnGet"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>
    <logger name ="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnCheckSecondaryLocks"  level="${rpcLog.level}" additivity="false">
        <appender-ref ref="ASYNC-TXN_RPC"/>
    </logger>

    <!-- Frequently printed logs need to be turned off -->
    <logger name="io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler" additivity="false">
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$ExecutorHeartbeat" additivity="false">
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.StoreServiceDescriptors$TxnHeartbeat" additivity="false">
    </logger>
    <logger name="io.dingodb.sdk.service.desc.store.CoordinatorServiceDescriptors$ExecutorHeartbeat" additivity="false">
    </logger>

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