You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/06/20 03:27:50 UTC

[GitHub] [skywalking] SayMr commented on pull request #567: support for logback MDC

SayMr commented on pull request #567:
URL: https://github.com/apache/skywalking/pull/567#issuecomment-646931122


   > * xml
   
   <!-- 按照每天生成日志文件 -->
       <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
           <file>${LOG_HOME}/${HOSTNAME}.log</file>
           <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
               <!--日志文件输出的文件名-->
               <FileNamePattern>${LOG_HOME}/${HOSTNAME}.%d{yyyy-MM-dd}.%i.log.gz</FileNamePattern>
           <MaxFileSize>256MB</MaxFileSize>
               <!--日志文件保留天数-->
               <MaxHistory>30</MaxHistory>
           </rollingPolicy>
           <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
               <layout class="org.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout">
                   <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
                   <pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] %X{tid}  [%thread] [%-5level] [%logger{50}]  [%msg] [%exception]</pattern>
               </layout>
           </encoder>
           <append>false</append>
           <prudent>false</prudent>
       </appender>
   
   logback.xml 配置成这样,server启动时报错,信息如下:
   020-06-20 10:42:29.112 ERROR 1 --- [ost-startStop-1] o.s.boot.SpringApplication               : Application startup fail
   ed
   java.lang.IllegalStateException: Logback configuration error detected:
   ERROR in ch.qos.logback.core.pattern.parser.Compiler@3d0234bf - There is no conversion class registered for conversion wo
   rd [tid]
   ERROR in ch.qos.logback.core.pattern.parser.Compiler@3d0234bf - [tid] is not a valid conversion word
   ERROR in ch.qos.logback.core.pattern.parser.Compiler@3270c078 - There is no conversion class registered for conversion wo
   rd [tid]
   ERROR in ch.qos.logback.core.pattern.parser.Compiler@3270c078 - [tid] is not a valid conversion word
   大神帮忙分析下


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org