<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- 引入Spring Boot默认配置 -->
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>

    <!-- 控制台输出（UTF-8编码，支持中文） -->
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <charset>UTF-8</charset>
            <pattern>%d{HH:mm:ss} [%thread] %-5level %logger{30} - %msg%n</pattern>
        </encoder>
    </appender>

    <!-- 数据库日志Appender（通过Spring初始化） -->
    <appender name="DATABASE" class="com.zhpb.gdyd_zhpb_zgf.config.DatabaseLogAppender">
    </appender>

    <!-- 根日志级别 -->
    <root level="INFO">
        <appender-ref ref="CONSOLE"/>
        <appender-ref ref="DATABASE"/>
    </root>

    <!-- 应用日志级别 -->
    <logger name="com.zhpb.gdyd_zhpb_zgf" level="DEBUG"/>
    
    <!-- 抑制Hibernate和JPA的日志输出 -->
    <logger name="org.hibernate" level="WARN"/>
    <logger name="org.hibernate.SQL" level="OFF"/>
    <logger name="org.hibernate.type" level="OFF"/>
    <logger name="org.hibernate.type.descriptor.sql" level="OFF"/>
    
    <!-- Spring框架日志 -->
    <logger name="org.springframework" level="INFO"/>
    <logger name="org.springframework.data" level="WARN"/>
</configuration>


