Apache JMeter – log Function

log is an in-build function of Apache JMeter and its type is ‘Information’. The log function writes a message in the log file or console along with the input string value. It means it prints the input string in the log file or console. By the way, JMeter in-build functions are divided into eight categories which are:

  1. Information
  2. Input
  3. Calculation
  4. Formatting
  5. Scripting
  6. Properties
  7. Variables
  8. Strings
Apache JMeter log function

Syntax: ${__log(Message)}

Type: Information

Purpose: To print the message in the log file or console output.

Input Argument: The log function has 4 arguments among them 3 are optional:

  • String to be logged (and returned): It represents a message that you want to print in the log file
  • Log Level: The following are the log levels:
    • OUT
    • ERR
    • DEBUG
    • INFO (default)
    • WARN
    • ERROR
  • Throwable text: It is an optional input parameter. If the string is non-empty then a throwable string can be returned to understand the exact error. It is similar to the Throwable class concept of Java.
  • Additional comment: It is a user comment which is optional.

Return Value: This function returns the message string to print in the log file or console window.

Related Functions:

You may be interested: