0

I created a basic HttpRequest call in Jmeter (GET https:www.google.com) with a JSR223 PostProcessor with the following code(this is just an example):

log.info("log");
System.out.println("Sysout");
println("println");

When I run the performance test via command line with the following command:

jmeter -n -t example.jmx -l ./example.log -e -o ./html_report -Lorg=FATAL

I can make log.info("log") to not be printed to the console (thanks to the param -Lorg=FATAL), but the other two entries (Sysout and println) keep being printed.

My goal is to just print the summary data in the console without any entry (log, print, system.out) to be printed (so I can monitor the progress), my expected output would be:

Starting standalone test @ Wed Mar 09 11:03:34 EST 2022 (1646841814615)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary =     10 in 00:00:12 =    0.8/s Avg:  1224 Min:   979 Max:  3247 Err:     0 (0.00%)
Tidying up ...    @ Wed Mar 09 11:03:47 EST 2022 (1646841827566)
... end of run

How can I disable the other outputs?

Note: Disabling/commenting the code lines is not allowed of course

Eduardo
  • 2,070
  • 21
  • 26

2 Answers2

0

If you are not interested in jmeter.log file at all you can turn off all logging completely and leave only Summariser class

In log4j2.xml file:

  1. Change line 51 from <Root level="info"> to <Root level="Off">

  2. Add <Logger name="org.apache.jmeter.reporters" level="info"/> line to <Loggers> section

  3. Optionally you can comment out or delete all other entries in <Loggers section

Full log4j2.xml file just in case:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="org.apache.jmeter.gui.logging">

  <Appenders>
    <File name="jmeter-log" fileName="${sys:jmeter.logfile:-jmeter.log}" append="false">
      <PatternLayout>
        <pattern>%d %p %c{1.}: %m%n</pattern>
      </PatternLayout>
    </File>

    <GuiLogEvent name="gui-log-event">
      <PatternLayout>
        <pattern>%d %p %c{1.}: %m%n</pattern>
      </PatternLayout>
    </GuiLogEvent>

  </Appenders>

  <Loggers>

    <Root level="Off">
      <AppenderRef ref="jmeter-log" />
      <AppenderRef ref="gui-log-event" />
    </Root>

    <Logger name="org.apache.jmeter.reporters" level="info"/>

  </Loggers>

</Configuration>

This way the jmeter.log file will only contain the "summary" of your test execution.

More information: How to Configure JMeter Logging

There is no way to play this trick with the STDOUT, you can either disable it completely or have everything, however you can filter the output using i.e. grep command

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0

I found the answer by myself, since STDOUT is something I cannot get rid off in a selective way(and apparently println neither) I just grep the output:

jmeter -n -t example.jmx -l ./example.log -e -o ./html_report -Lorg=FATAL | grep 'summary\|Tidying\|end'

and this is my output

Creating summariser <summary>
summary +      7 in 00:00:12 =    0.6/s Avg:  1669 Min:   620 Max:  6131 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary +     31 in 00:00:30 =    1.0/s Avg:   976 Min:   270 Max:  1052 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary =     38 in 00:00:43 =    0.9/s Avg:  1104 Min:   270 Max:  6131 Err:     0 (0.00%)
summary +     12 in 00:00:12 =    1.0/s Avg:   993 Min:   812 Max:  1051 Err:     0 (0.00%) Active: 0 Started: 1 Finished: 1
summary =     50 in 00:00:55 =    0.9/s Avg:  1077 Min:   270 Max:  6131 Err:     0 (0.00%)
Tidying up ...    @ Wed Mar 09 11:29:12 EST 2022 (1646843352418)
... end of run

cheers!!

Eduardo
  • 2,070
  • 21
  • 26