简体   繁体   English

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

[英]How to disable JMeter log information output to console (in java)

I was developing a jmeter test plan from java code, and I've installed jmeter api from maven. 我正在用Java代码开发一个jmeter测试计划,并且已经从maven安装了jmeter api。

It runs successfully. 它运行成功。 However, it shows lots of needless information on the console. 但是,它在控制台上显示了很多不必要的信息。

Here is my environment: 这是我的环境:

  • JavaSE 1.7 JavaSE 1.7
  • JMeter 3.0 JMeter 3.0
  • Windows 7 Windows 7的

And I'm forced to do that although I know it's the old version of java and jmeter. 尽管我知道这是Java和Jmeter的旧版本,但我被迫这样做。

I've tried to configure jmeter.properties, logkit.xml and log4j.conf file, but it remains the same. 我尝试配置jmeter.properties,logkit.xml和log4j.conf文件,但它保持不变。

The information showing on console looks like: 控制台上显示的信息如下:

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

Can anyone help me? 谁能帮我?

If you want to suppress JMeter logging you can set the log level for JMeter to FATAL_ERROR by providing the relevant JMeter Properties 如果要禁止JMeter日志记录,可以通过提供相关的JMeter属性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>

In general you should not see any of JMeter log entries in the console so it seems you have configuration overrides somewhere so it would be better to revert the changes you made rather than applying my solution. 通常,您应该在控制台中看不到任何JMeter日志条目,因此似乎您在某处具有配置替代,因此最好是还原所做的更改,而不是应用我的解决方案。

More information: How to Configure JMeter Logging 详细信息: 如何配置JMeter日志记录

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM