请教个位大神
jmeter +jenkins +ant 遇到这个问题,jtl日志无法更新,本地查到的都是第一次打印出来的
jenkins打包日志是:
Started by user jankey Building in workspace /Users/Shared/Jenkins/Home/workspace/test > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url https://github.com/jankeyhui/TESTRO # timeout=10 Fetching upstream changes from https://github.com/jankeyhui/TESTRO > git --version # timeout=10 using GIT_ASKPASS to set credentials > git fetch --tags --progress https://github.com/jankeyhui/TESTRO +refs/heads/*:refs/remotes/origin/* > git rev-parse refs/remotes/origin/master^{commit} # timeout=10 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10 Checking out Revision a92a7ccbb7862a3f5b6cc4dfb74be96cd6afbb51 (refs/remotes/origin/master) Commit message: "3" > git config core.sparsecheckout # timeout=10 > git checkout -f a92a7ccbb7862a3f5b6cc4dfb74be96cd6afbb51 > git rev-list a92a7ccbb7862a3f5b6cc4dfb74be96cd6afbb51 # timeout=10 [extras] $ /usr/local/apache-ant-1.9.9/bin/ant -file build.xml all Buildfile: /usr/local/apache-jmeter-3.2/extras/build.xml all: login: [jmeter] Executing test plan: /Users/Shared/Jenkins/Home/workspace/test/TEST_ALL11.jmx ==> /usr/local/apache-jmeter-3.2/extras/report/jtl/TestReport201712221026.jtl [jmeter] SLF4J: Class path contains multiple SLF4J bindings. [jmeter] SLF4J: Found binding in [jar:file:/usr/local/apache-jmeter-3.2/lib/log4j-slf4j-impl-2.8.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] [jmeter] SLF4J: Found binding in [jar:file:/usr/local/apache-jmeter-3.2/lib/ext/WeekLoanLogin%202.jar!/org/slf4j/impl/StaticLoggerBinder.class] [jmeter] SLF4J: Found binding in [jar:file:/usr/local/apache-jmeter-3.2/lib/ext/WeekLoanLogin.jar!/org/slf4j/impl/StaticLoggerBinder.class] [jmeter] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. [jmeter] SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory] [jmeter] 2017-12-22 10:26:55,948 main ERROR FileManager (jmeter.log) java.io.FileNotFoundException: jmeter.log (Permission denied) java.io.FileNotFoundException: jmeter.log (Permission denied) [jmeter] at java.io.FileOutputStream.open0(Native Method) [jmeter] at java.io.FileOutputStream.open(FileOutputStream.java:270) [jmeter] at java.io.FileOutputStream.<init>(FileOutputStream.java:213) [jmeter] at org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory.createManager(FileManager.java:290) [jmeter] at org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory.createManager(FileManager.java:274) [jmeter] at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:112) [jmeter] at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114) [jmeter] at org.apache.logging.log4j.core.appender.FileManager.getFileManager(FileManager.java:112) [jmeter] at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:86) [jmeter] at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:51) [jmeter] at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244) [jmeter] at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) [jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) [jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) [jmeter] at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) [jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) [jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) [jmeter] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) [jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122) [jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43) [jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) [jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29) [jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358) [jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383) [jmeter] at org.apache.jmeter.JMeter.<clinit>(JMeter.java:109) [jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [jmeter] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [jmeter] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [jmeter] at java.lang.Class.newInstance(Class.java:442) [jmeter] at org.apache.jmeter.NewDriver.main(NewDriver.java:246) [jmeter] [jmeter] 2017-12-22 10:26:55,955 main ERROR Unable to inject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.FileAppender, element File. java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.FileManager$FileManagerFactory@2f177a4b] unable to create manager for [jmeter.log] with data [org.apache.logging.log4j.core.appender.FileManager$FactoryData@4278a03f] [jmeter] at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:114) [jmeter] at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114) [jmeter] at org.apache.logging.log4j.core.appender.FileManager.getFileManager(FileManager.java:112) [jmeter] at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:86) [jmeter] at org.apache.logging.log4j.core.appender.FileAppender$Builder.build(FileAppender.java:51) [jmeter] at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244) [jmeter] at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) [jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) [jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) [jmeter] at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) [jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) [jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) [jmeter] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) [jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122) [jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43) [jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) [jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29) [jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358) [jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383) [jmeter] at org.apache.jmeter.JMeter.<clinit>(JMeter.java:109) [jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [jmeter] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [jmeter] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [jmeter] at java.lang.Class.newInstance(Class.java:442) [jmeter] at org.apache.jmeter.NewDriver.main(NewDriver.java:246) [jmeter] [jmeter] 2017-12-22 10:26:55,958 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.FileAppender for element File. java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.FileAppender [jmeter] at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:224) [jmeter] at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:130) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232) [jmeter] at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244) [jmeter] at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) [jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617) [jmeter] at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634) [jmeter] at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229) [jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152) [jmeter] at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45) [jmeter] at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194) [jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:122) [jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43) [jmeter] at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) [jmeter] at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29) [jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358) [jmeter] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383) [jmeter] at org.apache.jmeter.JMeter.<clinit>(JMeter.java:109) [jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [jmeter] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [jmeter] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [jmeter] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [jmeter] at java.lang.Class.newInstance(Class.java:442) [jmeter] at org.apache.jmeter.NewDriver.main(NewDriver.java:246) [jmeter] [jmeter] 2017-12-22 10:26:55,968 main ERROR Null object returned for File in Appenders. [jmeter] 2017-12-22 10:26:55,979 main ERROR Unable to locate appender "jmeter-log" for logger config "root" [jmeter] Creating summariser <summary> [jmeter] Created the tree successfully using /Users/Shared/Jenkins/Home/workspace/test/TEST_ALL11.jmx [jmeter] Starting the test @ Fri Dec 22 10:27:03 CST 2017 (1513909623277) [jmeter] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445 [jmeter] summary + 1 in 00:00:00 = 4.0/s Avg: 30 Min: 30 Max: 30 Err: 0 (0.00%) Active: 2 Started: 2 Finished: 0 [jmeter] summary + 27 in 00:00:16 = 1.7/s Avg: 387 Min: 2 Max: 1651 Err: 4 (14.81%) Active: 0 Started: 2 Finished: 2 [jmeter] summary = 28 in 00:00:16 = 1.8/s Avg: 374 Min: 2 Max: 1651 Err: 4 (14.29%) [jmeter] Tidying up ... @ Fri Dec 22 10:27:19 CST 2017 (1513909639377) [jmeter] ... end of run report: BUILD FAILED /usr/local/apache-jmeter-3.2/extras/build.xml:22: The following error occurred while executing this line: /usr/local/apache-jmeter-3.2/extras/build.xml:33: input file /usr/local/apache-jmeter-3.2/extras/report/jtl/TestReport201712221026.jtl does not exist Total time: 31 seconds Build step 'Invoke Ant' marked build as failure [htmlpublisher] Archiving HTML reports... [htmlpublisher] Archiving at PROJECT level /usr/local/apache-jmeter-3.2/extras/report/html to /Users/Shared/Jenkins/Home/jobs/test/htmlreports/HTML_Report Performance: Recording JMeter reports '/Users/Shared/Jenkins/Home/jobs/test/builds/53/temp/TestReport201712211134.jtl' Performance: Parsing JMeter report file '/Users/Shared/Jenkins/Home/jobs/test/builds/53/performance-reports/JMeter/TestReport201712211134.jtl'. Performance: No threshold configured for making the test unstable Performance: No threshold configured for making the test failure Performance: File TestReport201712211134.jtl reported 21.875% of errors [SUCCESS]. Build status is: FAILURE Finished: FAILURE
build.xml文件
<?xml version="1.0" encoding="utf-8"?>
<project name="JmeterTest"default="all"basedir=".">
<tstamp>
<format property="time"pattern="yyyyMMddhhmm" />
</tstamp>
<!-- 需要改成自己本地的 Jmeter 目录-->
<property name="jmeter.home"value="/usr/local/apache-jmeter-3.2" />
<!-- jmeter生成jtl格式的结果报告的路径-->
<property name="jmeter.result.jtl.dir"value="report/jtl" />
<!-- jmeter生成html格式的结果报告的路径-->
<property name="jmeter.result.html.dir"value="report/html" />
<!-- 生成的报告的前缀 -->
<property name="ReportName"value="TestReport" />
<property name="jmeter.result.jtlName"value="${jmeter.result.jtl.dir}/${ReportName}${time}.jtl" />
<property name="jmeter.result.htmlName"value="${jmeter.result.html.dir}/${ReportName}${time}.html" />
<!-- 接收测试报告的邮箱 -->
<property name="mail_to"value="ex-liangzehui001@pingan.com.cn" />
<!-- 电脑地址 -->
<property name="ComputerName"value="liangzehui" />
<target name="all">
<antcall target="login" />
<antcall target="report" />
</target>
<target name="login">
<taskdef name="jmeter"classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" />
<jmeter jmeterhome="${jmeter.home}"resultlog="${jmeter.result.jtlName}">
<!-- 声明要运行的脚本。"*.jmx"指包含此目录下的所有jmeter脚本 -->
<testplans dir="/Users/Shared/Jenkins/Home/workspace/test"includes="*.jmx" />
<property name="jmeter.save.saveservice.output_format"value="xml" />
</jmeter>
</target>
<target name="report">
<xslt in="${jmeter.result.jtlName}"out="${jmeter.result.htmlName}"style="${jmeter.home}/extras/jmeter-results-detail-report_21.xsl" />
<!-- 因为上面生成报告的时候,不会将相关的图片也一起拷贝至目标目录,所以,需要手动拷贝 -->
<copy todir="${jmeter.result.html.dir}">
<fileset dir="${jmeter.home}/extras">
<include name="collapse.png" />
<include name="expand.png" />
</fileset>
</copy>
</target>
<!-- 发送邮件 -->
</project>
jmeter log 是权限问题 因为放在/usr文件夹所以要设置权限
jtl不更新因为是build.xml里面的代码有问题。