ick01.example-apachedubbo-producer.1.0.4-RELEASE.source-code.logback.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <configuration debug="false" scan="true" scanPeriod="30 minutes"> <statusListener class="ch.qos.logback.core.status.NopStatusListener" /> <!-- 引入外部配置文件的地址 --> <property resource="logback.properties"/> <!-- 控制台输出 --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>${STDOUT_LEVEL}</level> </filter> <encoder class="net.logstash.logback.encoder.LogstashEncoder"> <version>${LOG_VERSION}</version> <includeMdcKeyName>traceId</includeMdcKeyName> <includeMdcKeyName>spanId</includeMdcKeyName> <includeMdcKeyName>parentId</includeMdcKeyName> <includeMdcKeyName>request_type</includeMdcKeyName> </encoder> </appender> <!-- INFO级别的日志 --> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_HOME}/${FILE_NAME}.log</file> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>${FILE_LEVEL}</level> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!--日志文件输出的文件名--> <!-- 文件扩展名设置为.zip/.gz后在文件滚动时会自动对旧日志进行压缩 --> <FileNamePattern>${LOG_HOME}/${FILE_NAME}.log.%d{yyyyMMdd}.%i.zip</FileNamePattern> <!-- 除按日志记录之外,还配置了日志文件不能超过512MB,若超过512MBM,日志文件会以索引0开始,命名日志文件,例如log-error-2013-12-21.0.log --> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILE_MAX_SIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <!--日志文件保留天数--> <MaxHistory>${FILE_HISTORY}</MaxHistory> <totalSizeCap>${FILE_TOTAL_SIZE}</totalSizeCap> </rollingPolicy> <encoder class="net.logstash.logback.encoder.LogstashEncoder"> <version>${LOG_VERSION}</version> <includeMdcKeyName>traceId</includeMdcKeyName> <includeMdcKeyName>spanId</includeMdcKeyName> <includeMdcKeyName>parentId</includeMdcKeyName> <includeMdcKeyName>request_type</includeMdcKeyName> </encoder> <prudent>false</prudent> </appender> <!-- DEBUG级别的日志 --> <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_HOME}/debug/${FILE_NAME}_debug.log</file> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>${FILE_DEBUG_LEVEL}</level> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!--日志文件输出的文件名--> <!-- 文件扩展名设置为.zip/.gz后在文件滚动时会自动对旧日志进行压缩 --> <FileNamePattern>${LOG_HOME}/debug/${FILE_NAME}_debug.log.%d{yyyyMMdd}.%i.zip</FileNamePattern> <!-- 除按日志记录之外,还配置了日志文件不能超过512MB,若超过512MBM,日志文件会以索引0开始,命名日志文件,例如log-error-2013-12-21.0.log --> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILE_DEBUG_MAX_SIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <!--日志文件保留天数--> <MaxHistory>${FILE_DEBUG_HISTORY}</MaxHistory> <totalSizeCap>${FILE_DEBUG_TOTAL_SIZE}</totalSizeCap> </rollingPolicy> <encoder class="net.logstash.logback.encoder.LogstashEncoder"> <version>${LOG_VERSION}</version> <includeMdcKeyName>traceId</includeMdcKeyName> <includeMdcKeyName>spanId</includeMdcKeyName> <includeMdcKeyName>parentId</includeMdcKeyName> <includeMdcKeyName>request_type</includeMdcKeyName> </encoder> <prudent>false</prudent> </appender> <!-- ERROR级别的日志 --> <appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${LOG_HOME}/error/${FILE_NAME}_error.log</file> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>${FILE_ERROR_LEVEL}</level> </filter> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!--日志文件输出的文件名--> <!-- 文件扩展名设置为.zip/.gz后在文件滚动时会自动对旧日志进行压缩 --> <FileNamePattern>${LOG_HOME}/error/${FILE_NAME}_error.log.%d{yyyyMMdd}.%i.zip</FileNamePattern> <!-- 除按日志记录之外,还配置了日志文件不能超过512MB,若超过512MBM,日志文件会以索引0开始,命名日志文件,例如log-error-2013-12-21.0.log --> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>${FILE_ERROR_MAX_SIZE}</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <!--日志文件保留天数--> <MaxHistory>${FILE_ERROR_HISTORY}</MaxHistory> <totalSizeCap>${FILE_ERROR_TOTAL_SIZE}</totalSizeCap> </rollingPolicy> <encoder class="net.logstash.logback.encoder.LogstashEncoder"> <version>${LOG_VERSION}</version> <includeMdcKeyName>traceId</includeMdcKeyName> <includeMdcKeyName>spanId</includeMdcKeyName> <includeMdcKeyName>parentId</includeMdcKeyName> <includeMdcKeyName>request_type</includeMdcKeyName> </encoder> <prudent>false</prudent> </appender> <!-- 日志输出级别 --> <logger name="org.apache.zookeeper" level="WARN" /> <root> <appender-ref ref="STDOUT"/> <appender-ref ref="FILE"/> <appender-ref ref="FILE_DEBUG"/> <appender-ref ref="FILE_ERROR"/> </root> </configuration>
© 2015 - 2024 Weber Informatics LLC | Privacy Policy