logback.xml 3.92 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
<configuration scan="true" scanPeriod="60 seconds">

    <appender name="REQ" class="ch.qos.logback.classic.sift.SiftingAppender">
        <discriminator>
            <key>logName</key>
            <defaultValue>default</defaultValue>
        </discriminator>
        <sift>
            <appender name="REQ-${logName}" class="ch.qos.logback.core.rolling.RollingFileAppender">
                <encoder>
                    <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%X{userId}] [%X{requestId}] %logger - %msg%n</pattern>
                </encoder>
                <file>${catalina.base}/logs/leaf-${logName}.log</file>
                <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                    <fileNamePattern>${catalina.base}/logs/%d{yyyy-MM-dd}/hls-${logName}.log</fileNamePattern>
                </rollingPolicy>
            </appender>
        </sift>
    </appender>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%X{userId}] [%X{requestId}] %logger[%line] - %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="BASE_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%X{userId}] [%X{requestId}] %logger[%line] - %msg%n</pattern>
        </encoder>
        <file>${catalina.base}/logs/leaf-base.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${catalina.base}/logs/leaf-base-%d{yyyy-MM-dd}.log</fileNamePattern>
        </rollingPolicy>
    </appender>

    <appender name="DB_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%X{userId}] [%X{requestId}] %logger[%line] - %msg%n</pattern>
        </encoder>
        <file>${catalina.base}/logs/leaf-db.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${catalina.base}/logs/leaf-db-%d{yyyy-MM-dd}.log</fileNamePattern>
        </rollingPolicy>
    </appender>

    <root level="DEBUG">
        <appender-ref ref="STDOUT"/>
        <appender-ref ref="REQ" />
        <!-- <appender-ref ref="BASE_LOG" /> -->
    </root>
    <logger name="hls.core.sys.mapper.SysNoticeMsgMapper" level="OFF">
    </logger>
    <logger name="org.mybatis.spring.transaction.SpringManagedTransaction" level="OFF">
    </logger>
    <logger name="org.mybatis.spring.SqlSessionUtils" level="OFF">
    </logger>
    <logger name="com.zaxxer" level="INFO" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>
    <logger name="com.zaxxer.hikari" level="DEBUG" additivity="false">
        <appender-ref ref="DB_LOG" />
    </logger>
    <logger name="leaf" level="DEBUG" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>
    <logger name="leaf.database" level="TRACE" additivity="false">
        <appender-ref ref="DB_LOG" />
    </logger>
    <logger name="org.activiti.engine" level="INFO" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>
    <logger name="org.activiti.spring.SpringTransactionInterceptor" level="INFO" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>
    <logger name="org.apache.ibatis.transaction.managed.ManagedTransaction" level="INFO" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>
    <logger name="org.quartz.core.QuartzSchedulerThread" level="INFO" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>
    <logger name="org.springframework.scheduling.quartz.LocalDataSourceJobStore" level="INFO" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>
    <logger name="org.quartz.impl.jdbcjobstore.StdRowLockSemaphore" level="INFO" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>


</configuration>