Java Spring AOP记录器跟踪ID与Spring Cloud Sleuth?

Java Spring AOP记录器跟踪ID与Spring Cloud Sleuth?,java,logging,aop,spring-aop,spring-cloud-sleuth,Java,Logging,Aop,Spring Aop,Spring Cloud Sleuth,我有一些使用SpringCloudSleuth作为分布式日志管理器运行的微服务。对于一些微服务,还包括SpringAOP,主要是关于方法执行时间日志的@Around建议(代码如下) 现在,我可能错过了这里的AOP点,也不太明白什么时候@Around通知真正起作用了,但是有可能在@Aspect定义的类生成的日志中包含侦探跟踪ID吗 代码: @Aspect类(从org.aspectj和org.slf4j导入): Spring启动版本为2.0.7.0版本(Spring Cloud Finchley.S

我有一些使用SpringCloudSleuth作为分布式日志管理器运行的微服务。对于一些微服务,还包括SpringAOP,主要是关于方法执行时间日志的
@Around
建议(代码如下)

现在,我可能错过了这里的AOP点,也不太明白什么时候
@Around
通知真正起作用了,但是有可能在
@Aspect
定义的类生成的日志中包含侦探跟踪ID吗

代码:

@Aspect
类(从
org.aspectj
org.slf4j
导入):

Spring启动版本为2.0.7.0版本(Spring Cloud Finchley.SR2),相关(Maven)依赖项为:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-aop</artifactId>
</dependency>
紧接着,下面是性能日志(没有跟踪ID):

两种情况下的进口均为:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
配置中的日志记录模式:

logging:
  // other config
  pattern:
    console: "%d{dd.MM.yyyy HH:mm:ss} ${LOG_LEVEL_PATTERN:-%5p} %m%n"

解决方案:如果要使用Kibana分析所有行并查看每行上的跟踪id,请不要在日志(
\n
)中使用行分隔符。

在应用程序的任何其他日志中是否看到跟踪id(即,您是否使用了正确的日志库和格式规范)?相位实际上没有任何特殊的状态。是的,我可以看到它们。我已经用这些额外的信息更新了这个问题。我觉得日志格式不同。你确定它是同一个日志系统吗?我已经从Kibana复制了完整的日志条目,所以“开发后端客户服务”的第一部分是Kibana默认格式条目。“dev backend customer service”后面的部分是我的微服务的日志格式,所以我们只能关注这一部分。我相信它是同一个日志系统。您希望我提供一些附加信息或部分代码吗?非常感谢。
January 31st 2019, 09:44:31.024 dev-backend customer-service    31.01.2019 08:44:50 DEBUG [customer-service,f9c173ae7a161cd6,f9c173ae7a161cd6,false] Request for file upload.
January 31st 2019, 09:44:50.532 dev-backend customer-service    method: fileUploadAzure

January 31st 2019, 09:44:50.532 dev-backend customer-service    ---- Performance aspect ----

January 31st 2019, 09:44:50.532 dev-backend customer-service    execution time: 19507 [ms]
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
logging:
  // other config
  pattern:
    console: "%d{dd.MM.yyyy HH:mm:ss} ${LOG_LEVEL_PATTERN:-%5p} %m%n"