Commons component plugin - Macros - Logs


# DEBUG $(message)

What ?

This macro allows to write a message in the console with the DEBUG status.

Underlying instruction :

EXECUTE log WITH $({message}) USING $(logLevel:DEBUG) AS whatever

> Input :

  • message : The message to display.

Example :

# DEBUG $(This is a debug message logged with a macro)

SKF Script :

../../_images/log-debug-macro.png

To be able to see the message in the console, you need to activate maven debug output.

../../_images/log-debug-macro-debug-output.png

Console output :

../../_images/log-debug-macro-result.png


# ERROR $(message)

What ?

This macro allows to write a message in the console with the ERROR status.

Underlying instruction :

EXECUTE log WITH $({message}) USING $(logLevel:ERROR) AS whatever

> Input :

  • message : The message to display.

Example :

# ERROR $(This is an error message logged with a macro)

SKF Script :

../../_images/log-error-macro.png

Console output :

../../_images/log-error-macro-result.png


# INFO $(message)

What ?

This macro allows to write a message in the console with the INFO status.

Underlying instruction :

EXECUTE log WITH $({message}) USING $(logLevel:INFO) AS whatever

> Input :

  • message : The message to display.

Example :

# INFO $(This is an info message logged with a macro)

SKF Script :

../../_images/log-info-macro.png

Console output :

../../_images/log-info-macro-result.png


# WARN $(message)

What ?

This macro allows to write a message in the console with the WARN status.

Underlying instruction :

EXECUTE log WITH $({message}) USING $(logLevel:WARN) AS whatever

> Input :

  • message : The message to display.

Example :

# WARN $(This is a warn message logged with a macro)

SKF Script :

../../_images/log-warn-macro.png

Console output :

../../_images/log-warn-macro-result.png


# LOG FILE CONTENT FROM {file} WITH LEVEL {level}

What ?

This macro allows to write the content of a file in the console with the status of your choice (DEBUG,INFO,WARN,ERROR).

Underlying instruction :

LOAD {file} AS __target{%%r1}
EXECUTE log WITH __target{%%r1} USING $(logLevel:{level},multiline:yes) AS $()

> Input :

  • file : The file which you want to display the content.

Example :

# LOG FILE CONTENT FROM folder/example.txt WITH LEVEL INFO

File to log :

../../_images/log-multi-file-macro-first-content-file.png

SKF Script :

../../_images/log-file-macro.png

Console output :

../../_images/log-file-macro-result.png


# LOG FILE CONTENT FROM {content1} , {otherContent} WITH LEVEL {level}

What ?

This macro allows to write the content of multiple files in the console with the status of your choice (DEBUG,INFO,WARN,ERROR).

Underlying instruction :

# LOG FILE CONTENT FROM {content1} WITH LEVEL {level}
# LOG FILE CONTENT FROM {otherContent} WITH LEVEL {level}

> Input :

  • content1 : The selected file which you want to display the content.
  • otherContent : Another file which you want to display the content.

Example :

# LOG FILE CONTENT FROM folder/example.txt , folder/example2.txt WITH LEVEL WARN

First file to log :

../../_images/log-multi-file-macro-first-content-file.png

Second file to log :

../../_images/log-multi-file-macro-second-content-file.png

Resource folder where files to log are stored :

../../_images/log-multi-file-macro-resources-folder.png

SKF Script :

../../_images/log-multi-file-macro.png

Console output :

../../_images/log-multi-file-macro-result.png