<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Copyright 1999-2023 Alibaba Group Holding Ltd.
  ~
  ~ 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>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"/>
    
    <appender name="PREF_LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${user.home}/logs/nacos/perf.log</file>
        
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
            <fileNamePattern>${user.home}/logs/nacos/perf.log.%i</fileNamePattern>
            <maxIndex>${JM.LOG.RETAIN.COUNT:-7}</maxIndex>
        </rollingPolicy>
        
        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
            <maxFileSize>${JM.LOG.FILE.SIZE:-10MB}</maxFileSize>
        </triggeringPolicy>
        
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</pattern>
        </encoder>
    </appender>
    
    <logger name="org.apache" level="DEBUG" />
    <logger name="org.apache.http.wire" level="DEBUG" />
    <logger name="org.apache.http.headers" level="INFO" />
    <logger name="io.grpc.netty" level="INFO">
        <appender-ref ref="STDOUT"/>
    </logger>
    <logger name="komachi.sion.nacos" level="INFO">
        <appender-ref ref="PREF_LOG_FILE"/>
    </logger>
    
    <root level="INFO">
        <appender-ref ref="STDOUT"/>
    </root>
</configuration>
