如何禁用JMeter日志信息输出到控制台(Java)

时间:2019-07-19 10:07:54

标签: java maven jmeter jmeter-maven-plugin jdk1.7

我正在用Java代码开发一个jmeter测试计划,并且已经从maven安装了jmeter api。

它成功运行。但是,它在控制台上显示了很多不必要的信息。

这是我的环境:

  • JavaSE 1.7
  • JMeter 3.0
  • Windows 7

尽管我知道它是Java和jmeter的旧版本,但我被迫这样做。

我尝试配置jmeter.properties,logkit.xml和log4j.conf文件,但它保持不变。

控制台上显示的信息如下:

WARN    2019-07-19 17:35:43.944 [jmeter.u] (): Exception 'null' occurred when fetching boolean property:'summariser.log', defaulting to:true
WARN    2019-07-19 17:35:43.944 [jmeter.u] (): Exception 'null' occurred when fetching boolean property:'summariser.out', defaulting to:true
INFO    2019-07-19 17:35:43.955 [jmeter.u] (): Setting Locale to zh_TW
DEBUG   2019-07-19 17:35:44.457 [jmeter.g] (): setting element to enabled: true
INFO    2019-07-19 17:35:44.598 [jmeter.s] (): Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2
INFO    2019-07-19 17:35:44.726 [jmeter.s] (): Using SaveService properties file encoding UTF-8
INFO    2019-07-19 17:35:44.736 [jmeter.s] (): Using SaveService properties version 2.9
INFO    2019-07-19 17:35:44.736 [jmeter.s] (): All converter versions present and correct
Test Start
INFO    2019-07-19 17:35:44.739 [jmeter.e] (): Running the test!
INFO    2019-07-19 17:35:44.743 [jmeter.s] (): List of sample_variables: []
INFO    2019-07-19 17:35:44.743 [jmeter.s] (): List of sample_variables: []
DEBUG   2019-07-19 17:35:44.750 [jorphan.] (): searchPathsOrJars : [SOMEWHERE\apache-jmeter-3.0/lib/ext]
DEBUG   2019-07-19 17:35:44.750 [jorphan.] (): superclass : [interface org.apache.jmeter.functions.Function]
DEBUG   2019-07-19 17:35:44.750 [jorphan.] (): innerClasses : true annotations: false
DEBUG   2019-07-19 17:35:44.750 [jorphan.] (): contains: null notContains: null
DEBUG   2019-07-19 17:35:44.750 [jorphan.] (): searchPathsOrJars : [SOMEWHERE\apache-jmeter-3.0/lib/ext]
DEBUG   2019-07-19 17:35:44.754 [jorphan.] (): strPathsOrJars[0] : ApacheJMeter_tcp.jar
DEBUG   2019-07-19 17:35:44.754 [jorphan.] (): strPathsOrJars[1] : SOMEWHERE/apache-jmeter-3.0/lib/ext
DEBUG   2019-07-19 17:35:44.754 [jorphan.] (): strPathsOrJars[2] : ApacheJMeter_ftp.jar
DEBUG   2019-07-19 17:35:44.754 [jorphan.] (): strPathsOrJars[3] : ApacheJMeter_junit.jar
DEBUG   2019-07-19 17:35:44.754 [jorphan.] (): strPathsOrJars[4] : ApacheJMeter_java.jar
DEBUG   2019-07-19 17:35:44.754 [jorphan.] (): strPathsOrJars[5] : ApacheJMeter_mail.jar

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

如果要禁止JMeter日志记录,可以通过提供相关的JMeter Properties

来将JMeter的日志级别设置为FATAL_ERROR

<configuration>
    <propertiesJMeter>
        <log_level.jmeter>FATAL_ERROR</log_level.jmeter>
        <log_level.jmeter.junit>FATAL_ERROR</log_level.jmeter.junit>
        <log_level.jorphan>FATAL_ERROR</log_level.jorphan>
    </propertiesJMeter>
</configuration>

通常,您应该在控制台中看不到任何JMeter日志条目,因此似乎您在某处具有配置替代,因此最好是还原所做的更改,而不是应用我的解决方案。

更多信息:How to Configure JMeter Logging