gpt4 book ai didi

java - AspectJ 插件 Aspect Config 与 Maven 使用外部 Jar for Aspect

转载 作者:行者123 更新时间:2023-11-30 05:08:22 27 4
gpt4 key购买 nike

我正在使用 Perf4j 进行性能日志记录。

它指定您使用 aop.xml 来定义要在编译时调用哪个方面,具体取决于您使用的日志系统。我无法让它获取 src/main/webapp/meta-inf/aop.xml 中的 aop.xml 文件

我不知道如何让我的 Maven 插件只编织 log4j 方面。

                <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
<outxml>true</outxml>
<source>1.6</source>
<target>1.6</target>
<weaveDependencies>
<dependency>
<groupId>org.perf4j</groupId>
<artifactId>perf4j</artifactId>
</dependency>
</weaveDependencies>
<aspects>
<includes>
<include>org.perf4j.log4j.aop.TimingAspect</include>
</includes>
</aspects>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>

当我打包时,我得到以下内容。

[INFO] --- aspectj-maven-plugin:1.3:compile (default) @ trace-web ---
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceJSONController.getResults(javax.servlet.http.HttpServletResponse, javax.servlet.http.HttpServletRequest))' in Type 'com.idna.trace.web.controllers.TraceJSONController' (TraceJSONController.java:121) advised by around advice from 'org.perf4j.commonslog.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceJSONController.getResults(javax.servlet.http.HttpServletResponse, javax.servlet.http.HttpServletRequest))' in Type 'com.idna.trace.web.controllers.TraceJSONController' (TraceJSONController.java:121) advised by around advice from 'org.perf4j.log4j.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceJSONController.getResults(javax.servlet.http.HttpServletResponse, javax.servlet.http.HttpServletRequest))' in Type 'com.idna.trace.web.controllers.TraceJSONController' (TraceJSONController.java:121) advised by around advice from 'org.perf4j.javalog.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceJSONController.getResults(javax.servlet.http.HttpServletResponse, javax.servlet.http.HttpServletRequest))' in Type 'com.idna.trace.web.controllers.TraceJSONController' (TraceJSONController.java:121) advised by around advice from 'org.perf4j.slf4j.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:106) advised by around advice from 'org.perf4j.commonslog.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:106) advised by around advice from 'org.perf4j.log4j.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:106) advised by around advice from 'org.perf4j.javalog.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:106) advised by around advice from 'org.perf4j.slf4j.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsAddressModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:282) advised by around advice from 'org.perf4j.commonslog.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsAddressModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:282) advised by around advice from 'org.perf4j.log4j.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsAddressModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:282) advised by around advice from 'org.perf4j.javalog.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsAddressModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:282) advised by around advice from 'org.perf4j.slf4j.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsBmdModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:419) advised by around advice from 'org.perf4j.commonslog.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsBmdModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:419) advised by around advice from 'org.perf4j.log4j.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsBmdModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:419) advised by around advice from 'org.perf4j.javalog.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO] Join point 'method-execution(org.springframework.web.servlet.ModelAndView com.idna.trace.web.controllers.TraceHTMLController.getDetailsBmdModelAndView(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.springframework.ui.Model))' in Type 'com.idna.trace.web.controllers.TraceHTMLController' (TraceHTMLController.java:419) advised by around advice from 'org.perf4j.slf4j.aop.TimingAspect' (perf4j-0.9.13.jar!AbstractTimingAspect.class(from AbstractTimingAspect.java))
[INFO]

答案是Perf4J必须指定log4jonly,据我所知,它不能在maven插件配置中完成。

    <dependency>
<groupId>org.perf4j</groupId>
<artifactId>perf4j</artifactId>
<version>0.9.13</version>
<classifier>log4jonly</classifier>
</dependency>

最佳答案

答案是Perf4J必须指定log4jonly,据我所知,它不能在maven插件配置中完成。

<dependency>
<groupId>org.perf4j</groupId>
<artifactId>perf4j</artifactId>
<version>0.9.13</version>
<classifier>log4jonly</classifier>
</dependency>

关于java - AspectJ 插件 Aspect Config 与 Maven 使用外部 Jar for Aspect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4305161/

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