Code Monkey home page Code Monkey logo

tlog's Introduction

logo

Your star is my motivation to keep going, please help with a star in the top right corner if you like it

Overview

TLog is a lightweight distributed log tagging tracker, accessible in 10 minutes, automatically tags logs to complete microservice link tracking. Support log4j, log4j2, logback three logging framework, support dubbo, dubbox, springcloud three RPC framework

Project home page please click: project home page

Project documentation please click: project documentation

Sample project please click: sample project

Features

  • lightweight microservice log tracking by tagging the logs
  • Provide three types of access: javaagent completely non-intrusive access, bytecode one line of code access, configuration file-based access
  • Non-intrusive design for business code, easy to use, 10 minutes to access
  • support for common log4j, log4j2, logback three logging framework, and provides automatic detection, complete adaptation
  • support dubbo, dubbox, springcloud three RPC framework
  • support for Spring Cloud Gateway and Soul gateway
  • adaptation of HttpClient and Okhttp http call tag passing
  • support for three task frameworks, JDK's TimerTask, Quartz, XXL-JOB
  • Supports configuration of custom templates for log tags, providing the option of multiple system-level buried tags
  • Support for asynchronous thread tracking, including thread pools, multi-level asynchronous threads and other scenarios
  • Almost no performance loss, fast and stable, after pressure testing, the loss is 0.01%

Since the community group is over 200 people, you need to invite to join the group. Follow the public number and click Personal WeChat to add me, I can pull you into the group

offIical-wx

Open source is not easy, please sponsor TLog if you support it

zanshang

tlog's People

Contributors

bryan31 avatar hutaishi avatar kfcrun avatar lee723 avatar lijing4670516 avatar monkeyhome avatar mysinglelive avatar naah69 avatar weihubeats avatar why168 avatar xyohn avatar zendwang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tlog's Issues

能否考虑支持下DeferredResult异步处理

现象:当使用DeferredResult作为返回结果时,在业务中打印的日志链路id,与deferredResult.setResult打印的链路id是不一样的
image

deferredResult.setResult实现中,会模拟客户端再次向服务器端发起请求,看是否能解决这个问题以支持DeferredResult

集成gateway。traceId线程问题

gateway-log

下游服务log

开发者您好:
根据图示,目前我开发版本为:springcloud2022.0.1 springboot2.6.6 tlog-all 1.4.1

项目启动,通过gateway首次请求接口,gateway中的traceId不会打印出来,通过webflux 包下的代码看到是上下文对象没有实例化,推断为拦截器加载顺序的问题。下游web服务之间的传递没有问题。
最严重的问题是gateway的上下文对象会有线程问题,如图所示。请求了7次接口,前六次gateway没有打印traceId,第七次打印出来的traceId是第一次下游接口已经转发过的traceId

点操作符没有生效

版本:

version=1.5.0
groupId=com.yomahub
artifactId=tlog-all-spring-boot-starter

方法:

@TLogAspect({"invoiceRequest.omsOrder.id"})
public String red(InvoiceRequest invoiceRequest) throws Exception {}

InvoiceRequest:

@Data
public class InvoiceRequest {
    private OmsOrder omsOrder;
    private List<OmsOrderDetail> omsOrderDetailList;
    private BillingInfo billingInfo;
}

输出日志:

<0.1><12596419933634624> 红票开票返回信息:{"code":"E9402","describe":"金额超过对应蓝票剩余含税金额: ¥0.00","result":""}

没有输出业务标签

自定义Convertor 数据缺少最后一个字符。

包括页面文档在内,在使用自定义convertor的时候 。
除空字符串外 无论convert方法返回什么字符串 在日志打印中都缺少最后一个字符。
不太清楚这样设计的原因。
但日志打印内容并不是想要的内容。
现在为了达到想要的效果每次只能在后面拼接一个多余的字符才能解决。

spring cloud中用logback解析异常

光秃秃的spring boot用没啥问题

spring cloud里用 logback直接解析异常

10:01:13,113 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
10:01:13,113 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/Users/bootv/Desktop/Codes/vcloud/gateway/build/resources/main/logback.xml]
10:01:13,114 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
10:01:13,114 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/C:/Users/bootv/Desktop/Codes/vcloud/gateway/build/resources/main/logback.xml]
10:01:13,114 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/C:/Users/bootv/Desktop/Codes/vcloud/common/build/resources/main/logback.xml]
10:01:13,164 |-ERROR in ch.qos.logback.core.joran.event.SaxEventRecorder@7334aada - Parser configuration error occurred org.xml.sax.SAXNotRecognizedException: unrecognized feature http://xml.org/sax/features/external-general-entities
	at org.xml.sax.SAXNotRecognizedException: unrecognized feature http://xml.org/sax/features/external-general-entities
	at 	at org.gjt.xpp.sax2.Driver.setFeature(Driver.java:178)
	at 	at org.gjt.xpp.jaxp11.SAXParserImpl.setFeatures(SAXParserImpl.java:149)
	at 	at org.gjt.xpp.jaxp11.SAXParserImpl.<init>(SAXParserImpl.java:132)
	at 	at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.newSAXParserImpl(SAXParserFactoryImpl.java:114)
	at 	at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:142)
	at 	at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:82)
	at 	at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:57)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:151)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
	at 	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:64)
	at 	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:134)
	at 	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at 	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at 	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at 	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at 	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
	at 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
	at 	at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
	at 	at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
	at 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
	at 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
	at 	at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:178)
	at 	at com.codestepfish.GatewayApplication.main(GatewayApplication.java:10)

Failed to auto configure default logger context
Reported exception:
ch.qos.logback.core.joran.spi.JoranException: Parser configuration error occurred
	at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:89)
	at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:57)
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:151)
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:64)
	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:134)
	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
	at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
	at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
	at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:178)
	at com.codestepfish.GatewayApplication.main(GatewayApplication.java:10)
Caused by: org.xml.sax.SAXNotRecognizedException: unrecognized feature http://xml.org/sax/features/external-general-entities
	at org.gjt.xpp.sax2.Driver.setFeature(Driver.java:178)
	at org.gjt.xpp.jaxp11.SAXParserImpl.setFeatures(SAXParserImpl.java:149)
	at org.gjt.xpp.jaxp11.SAXParserImpl.<init>(SAXParserImpl.java:132)
	at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.newSAXParserImpl(SAXParserFactoryImpl.java:114)
	at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:142)
	at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:82)
	... 18 more
Logging system failed to initialize using configuration from 'null'
java.lang.IllegalStateException: Could not initialize Logback logging from classpath:logback.xml
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:168)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.reinitialize(LogbackLoggingSystem.java:232)
	at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:73)
	at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:132)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:329)
	at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:298)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:246)
	at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:223)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:85)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:66)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:65)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:343)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
	at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164)
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:195)
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:114)
	at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:77)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
	at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:85)
	at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:66)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:114)
	at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:65)
	at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:343)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1317)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at com.codestepfish.GatewayApplication.main(GatewayApplication.java:10)
Caused by: ch.qos.logback.core.joran.spi.JoranException: Parser configuration error occurred
	at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:89)
	at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:57)
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:151)
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.configureByResourceUrl(LogbackLoggingSystem.java:188)
	at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:165)
	... 39 more
Caused by: org.xml.sax.SAXNotRecognizedException: unrecognized feature http://xml.org/sax/features/external-general-entities
	at org.gjt.xpp.sax2.Driver.setFeature(Driver.java:178)
	at org.gjt.xpp.jaxp11.SAXParserImpl.setFeatures(SAXParserImpl.java:149)
	at org.gjt.xpp.jaxp11.SAXParserImpl.<init>(SAXParserImpl.java:132)
	at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.newSAXParserImpl(SAXParserFactoryImpl.java:114)
	at org.gjt.xpp.jaxp11.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:142)
	at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:82)
	... 45 more
Disconnected from the target VM, address: '127.0.0.1:2449', transport: 'socket'

Process finished with exit code 1

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <!--特殊字母相关的转换器-->
    <conversionRule conversionWord="clr"
                    converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
    <conversionRule conversionWord="wex"
                    converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
    <conversionRule conversionWord="wEx"
                    converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
    <!--日志pattern-->
    <property name="CONSOLE_LOG_PATTERN"
              value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
            <charset>utf8</charset>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="STDOUT"/>
    </root>

    <logger name="com.zaxxer.hikari.pool.HikariPool" level="INFO" additivity="false">
        <appender-ref ref="STDOUT"/>
    </logger>

</configuration>

tlog : 1.5.0

spring cloud 2021.0.3

spring cloud alibaba 2021.0.1.0

spring boot 2.6.11

微服务用的lombok集成TLog没有效果

微服务用的lombok集成TLog没有效果。
按照示例里面加的依赖,logback的文件复制的gateway示例里的。
在启动类增加了
//进行日志增强,自动判断日志框架
static {
AspectLogEnhance.enhance();
}
启动没有报错,调用提示“日志增强成功”,但是结果调用过程中,表没有出现作者说的有TraceId贯穿

TLogAspect value 获取值优化

TLogAspect value 获取值推荐使用spring el表达式更通用,如果el表达式获取不到值推荐直接返回el表达式里面的字符串,这样在使用起来更方便,单纯想添加业务字符串表示不用在定义一个AspectLogConvert

xxl-job同步增强失败

版本:1.3.2

com.yomahub
tlog-all-spring-boot-starter
1.3.2

接入方式:Logback框架适配器
springboot版本:Spring Boot v2.1.3.RELEASE
启动xxl报错:
image

TLogWebInvokeTimeInterceptor 统计请求执行时间时 出现 NullPointerException

您好,我在使用Tlog 的过程中,在项目内部使用请求转发时,TLogWebInvokeTimeInterceptor 内部出现了空指针异常,同一个请求进入了2次TLogWebInvokeTimeInterceptor,第二次进入TLogWebInvokeTimeInterceptor 可以从 invokeTimeTL 拿到 StopWatch ,并打印时间,最后remove。随之第一次进入TLogWebInvokeTimeInterceptor 的也会去从 invokeTimeTL 获取stopWatch,因为被线程remove掉了,所以拿到的stopWatch为空,最后调用stopWatch.stop() 方法出现了空指针,堆栈信息如下。
image
源码这边是否可以判空一下。

Dependency org.apache.tomcat.embed:tomcat-embed-core, leading to CVE problem

Hi, in tlog-webroot/,there is a dependency **org.apache.tomcat.embed:tomcat-embed-core:8.5.34
** that calls the risk method.

CVE-2019-17563

The scope of this CVE affected version is [9.0.0.M1, 9.0.30),[8.5.0,8.5.50),[,7.0.99)

After further analysis, in this project, the main Api called is org.apache.catalina.authenticator.AuthenticatorBase: register(org.apache.catalina.connector.Request,javax.servlet.http.HttpServletResponse,java.security.Principal,java.lang.String,java.lang.String,java.lang.String,boolean,boolean)

Risk method repair link : GitHub

CVE Bug Invocation Path--

Path Length : 8

com.yomahub.tlog.web.filter.ReplaceStreamFilter: doFilter(javax.servlet.ServletRequest,javax.servlet.ServletResponse,javax.servlet.FilterChain) .m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar
org.apache.catalina.core.ApplicationFilterChain: doFilter(javax.servlet.ServletRequest,javax.servlet.ServletResponse) .m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar
org.apache.catalina.core.ApplicationFilterChain: internalDoFilter(javax.servlet.ServletRequest,javax.servlet.ServletResponse) .m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar
org.apache.catalina.connector.Request: getUserPrincipal()Ljava.security.Principal; .m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar
org.apache.catalina.connector.Request: logout() .m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar
org.apache.catalina.authenticator.AuthenticatorBase: logout(org.apache.catalina.connector.Request) .m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar
org.apache.catalina.authenticator.AuthenticatorBase: register(org.apache.catalina.connector.Request,javax.servlet.http.HttpServletResponse,java.security.Principal,java.lang.String,java.lang.String,java.lang.String) .m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.34/tomcat-embed-core-8.5.34.jar
org.apache.catalina.authenticator.AuthenticatorBase: register(org.apache.catalina.connector.Request,javax.servlet.http.HttpServletResponse,java.security.Principal,java.lang.String,java.lang.String,java.lang.String,boolean,boolean)


Dependency tree--

[INFO] com.yomahub:tlog-webroot:jar:1.5.0
[INFO] +- com.yomahub:tlog-core:jar:1.5.0:compile
[INFO] |  +- com.yomahub:tlog-common:jar:1.5.0:compile
[INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] |  |  +- cn.hutool:hutool-core:jar:5.8.6:compile
[INFO] |  |  \- com.alibaba:transmittable-thread-local:jar:2.12.2:compile
[INFO] |  +- org.dom4j:dom4j:jar:2.1.3:compile
[INFO] |  +- org.javassist:javassist:jar:3.22.0-GA:compile
[INFO] |  +- org.aspectj:aspectjweaver:jar:1.8.13:compile
[INFO] |  +- com.alibaba:fastjson:jar:1.2.83:compile
[INFO] |  \- com.alibaba:QLExpress:jar:3.2.0:compile
[INFO] |     +- commons-beanutils:commons-beanutils:jar:1.8.2:compile
[INFO] |     +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |     \- commons-lang:commons-lang:jar:2.4:compile
[INFO] +- org.springframework:spring-webmvc:jar:5.0.9.RELEASE:provided
[INFO] |  +- org.springframework:spring-aop:jar:5.0.9.RELEASE:provided
[INFO] |  +- org.springframework:spring-beans:jar:5.0.9.RELEASE:provided
[INFO] |  +- org.springframework:spring-context:jar:5.0.9.RELEASE:provided
[INFO] |  +- org.springframework:spring-core:jar:5.0.9.RELEASE:provided
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.0.9.RELEASE:provided
[INFO] |  +- org.springframework:spring-expression:jar:5.0.9.RELEASE:provided
[INFO] |  \- org.springframework:spring-web:jar:5.0.9.RELEASE:provided
[INFO] \- org.springframework.boot:spring-boot-starter-web:jar:2.0.5.RELEASE:provided
[INFO]    +- org.springframework.boot:spring-boot-starter:jar:2.0.5.RELEASE:provided
[INFO]    |  +- org.springframework.boot:spring-boot:jar:2.0.5.RELEASE:provided
[INFO]    |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.5.RELEASE:provided
[INFO]    |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.0.5.RELEASE:provided
[INFO]    |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:provided
[INFO]    |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:provided
[INFO]    |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.10.0:provided
[INFO]    |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.12.0:provided
[INFO]    |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.25:provided
[INFO]    |  +- javax.annotation:javax.annotation-api:jar:1.3.2:provided
[INFO]    |  \- org.yaml:snakeyaml:jar:1.19:provided
[INFO]    +- org.springframework.boot:spring-boot-starter-json:jar:2.0.5.RELEASE:provided
[INFO]    |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:provided
[INFO]    |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:provided
[INFO]    |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.6:provided
[INFO]    |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.6:provided
[INFO]    |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.6:provided
[INFO]    |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.6:provided
[INFO]    +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.5.RELEASE:provided
[INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.34:provided
[INFO]    |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.34:provided
[INFO]    |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.34:provided
[INFO]    \- org.hibernate.validator:hibernate-validator:jar:6.0.12.Final:provided
[INFO]       +- javax.validation:validation-api:jar:2.0.1.Final:provided
[INFO]       +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:provided
[INFO]       \- com.fasterxml:classmate:jar:1.3.4:provided

Suggested solutions:

Update dependency version

Thank you very much.

能将dubbo和dubbox的warn日志改成debug吗?

log.warn("[TLOG]本地threadLocal变量没有正确传递traceId,本次调用不传递traceId");
这条日志在其他几个子项目里面都是打印成debug的,但是在dubbo和dubbox两个项目是warn,这两个项目能否也改成debug?

请问spirngboot中自定义的容器怎么获取TraceId?

package com.elite.common.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * 记录完整请求响应日志
 *
 */
@Slf4j
@Configuration
public class WebConfig {

    @Bean
    public OncePerRequestFilter contentCachingRequestFilter() {
        return new OncePerRequestFilter() {

            @Override
            protected void doFilterInternal(final HttpServletRequest request, final HttpServletResponse response, final FilterChain filterChain) throws ServletException, IOException {
                ContentCachingRequestWrapper wrappedRequest = new ContentCachingRequestWrapper(request);
                ContentCachingResponseWrapper wrappedResponse = new ContentCachingResponseWrapper(response);
                filterChain.doFilter(wrappedRequest, wrappedResponse);
                log.info("http request:{}", new String(wrappedRequest.getContentAsByteArray()));
                log.info("http response:{}", new String(wrappedResponse.getContentAsByteArray()));
                wrappedResponse.copyBodyToResponse();
            }
        };
    }

}

如上,我这里打印了http请求和响应日志,但是并没有traceId

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.