All Downloads are FREE. Search and download functionalities are using the official Maven repository.

log.logback.xml Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd">
<configuration>
    <property name="LOG_HOME" value="log"/>

    <!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,%i索引【从数字0开始递增】 -->

    <!-- ConsoleAppender:把日志输出到控制台 -->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d %X{traceId} %p (%file:%line\) - %m%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <appender name="serverLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_HOME}/server.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_HOME}/server.%d{yyyy-MM-dd}.log</fileNamePattern>
        </rollingPolicy>
        <encoder>
            <pattern>%d %X{traceId} %p [%thread] (%file:%line\) - %m %X{uri}%n</pattern>
            <charset>UTF-8</charset>
        </encoder>
    </appender>

    <logger name="com.luna.commons" additivity="false" level="INFO">
        <appender-ref ref="STDOUT"/>
    </logger>

    <!-- 控制台输出日志 -->
    <root level="info">
        <appender-ref ref="serverLog"/>
    </root>
</configuration>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy