We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug MDC filed do not display in the log file!
To Reproduce logback.xml
<!-- 控制台输出 --> <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>x_global_session_id</includeMdcKeyName> <includeMdcKeyName>spanId</includeMdcKeyName> <includeMdcKeyName>parentId</includeMdcKeyName> <includeMdcKeyName>request_type</includeMdcKeyName> <includeMdcKeyName>interface_name</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>x_global_session_id</includeMdcKeyName> <includeMdcKeyName>spanId</includeMdcKeyName> <includeMdcKeyName>parentId</includeMdcKeyName> <includeMdcKeyName>request_type</includeMdcKeyName> <includeMdcKeyName>interface_name</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>x_global_session_id</includeMdcKeyName> <includeMdcKeyName>spanId</includeMdcKeyName> <includeMdcKeyName>parentId</includeMdcKeyName> <includeMdcKeyName>request_type</includeMdcKeyName> <includeMdcKeyName>interface_name</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>x_global_session_id</includeMdcKeyName> <includeMdcKeyName>spanId</includeMdcKeyName> <includeMdcKeyName>parentId</includeMdcKeyName> <includeMdcKeyName>request_type</includeMdcKeyName> <includeMdcKeyName>interface_name</includeMdcKeyName> </encoder> <prudent>false</prudent> </appender> <!-- 日志输出级别 --> <logger name="org.springframework" level="DEBUG"/> <logger name="org.apache.catalina" level="DEBUG"/> <root> <appender-ref ref="STDOUT"/> <appender-ref ref="FILE"/> <appender-ref ref="FILE_DEBUG"/> <appender-ref ref="FILE_ERROR"/> </root>
Expected behavior A clear and concise description of what you expected to happen.
Additional context Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
The problem has been resolved
Sorry, something went wrong.
No branches or pull requests
Describe the bug
MDC filed do not display in the log file!
To Reproduce
logback.xml
Expected behavior
A clear and concise description of what you expected to happen.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: