gpt4 book ai didi

spring-boot - PerformanceMonitorInterceptor 没有日志记录

转载 作者:行者123 更新时间:2023-12-03 12:19:53 25 4
gpt4 key购买 nike

我为 PerformanceMonitorInterceptor 准备了这个简单的 bean

@Configuration
@EnableAspectJAutoProxy
@Aspect
public class PerfMetricsConfiguration {
/**
* Monitoring pointcut.
*/
@Pointcut("execution(* com.lapots.breed.judge.repository.*Repository.*(..))")
public void monitor() {
}

/**
* Creates instance of performance monitor interceptor.
* @return performance monitor interceptor
*/
@Bean
public PerformanceMonitorInterceptor performanceMonitorInterceptor() {
return new PerformanceMonitorInterceptor(true);
}

/**
* Creates instance of performance monitor advisor.
* @return performance monitor advisor
*/
@Bean
public Advisor performanceMonitorAdvisor() {
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
pointcut.setExpression("com.lapots.breed.judge.repository.PerfMetricsConfiguration.monitor()");
return new DefaultPointcutAdvisor(pointcut, performanceMonitorInterceptor());
}
}

它应该跟踪以 Repository 结尾的接口(interface)中的任何方法调用。名义上。
我在 application.properties 中设置了日志记录级别
logging.level.org.springframework.aop.interceptor.PerformanceMonitorInterceptor=TRACE

但在执行期间,它不会在控制台中写入任何内容。有什么问题?

最佳答案

在更改 useDynamicLogger 后,我遇到了类似的问题假的问题是固定的。

@Bean
public PerformanceMonitorInterceptor performanceMonitorInterceptor() {
return new PerformanceMonitorInterceptor(false);
}

关于spring-boot - PerformanceMonitorInterceptor 没有日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49106884/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com