我正在使用Perf4j进行性能记录。
它指定您使用aop.xml来定义在编译时要调用哪个Aspect,具体取决于您使用的日志系统。我无法获取它来获取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>
答案 0 :(得分:2)
答案是Perf4J必须指定log4jonly,就我所见,它无法在maven插件配置中完成。
<dependency>
<groupId>org.perf4j</groupId>
<artifactId>perf4j</artifactId>
<version>0.9.13</version>
<classifier>log4jonly</classifier>
</dependency>