Skip to content

Log

Purpose

Provides log methods.

Methods

Binding name:

  • p6.log

Warning

Since 6.1.1 - log binding is deprecated

Output

Every log call will generate:

stdout
[5-12-2020 16:40] <LEVEL> [GROOVYSCRIPT: <Logger name>] <Message>

The Logger name is equal to:

  • for script: io.platform6.app.<App Key | core>.scripts.<Script name>.Main
  • for route: io.platform6.app.<App Key | core>.routes.<Route name>.Main

Provided exceptions will only be visible inside the application log file and not inside the script output log.


trace

Generate a log message with the TRACE level.

Syntax

void p6.log.trace(String message)
Example
p6.log.trace("Message")

trace (with exception)

Generate a log message, and an exception with the TRACE level.

Syntax

void p6.log.trace(String message, Throwable exception)
Example
try {
} catch(Exception ex) {
    p6.log.trace("Message", ex)
}

debug

Generate a log message with the DEBUG level.

Syntax

void p6.log.debug(String message)
Example
p6.log.DEBUG("Message")

debug (with exception)

Generate a log message, and an exception with the DEBUG level.

Syntax

void p6.log.debug(String message, Throwable exception)
Example
try {
} catch(Exception ex) {
    p6.log.debug("Message", ex)
}

info

Generate a log message with the INFO level.

Syntax

void p6.log.info(String message)
Example
p6.log.info("Message")

info (with exception)

Generate a log message, and an exception with the INFO level.

Syntax

void p6.log.info(String message, Throwable exception)
Example
try {
} catch(Exception ex) {
    p6.log.info("Message", ex)
}

warn

Generate a log message with the WARN level.

Syntax

void p6.log.warn(String message)
Example
p6.log.warn("Message")

warn (with exception)

Generate a log message, and an exception with the WARN level.

Syntax

void p6.log.warn(String message, Throwable exception)
Example
try {
} catch(Exception ex) {
    p6.log.warn("Message", ex)
}

error

Generate a log message with the ERROR level.

Syntax

void p6.log.error(String message)
Example
p6.log.error("Message")

error (with exception)

Generate a log message, and an exception with the ERROR level.

Syntax

void p6.log.error(String message, Throwable exception)
Example
try {
} catch(Exception ex) {
    p6.log.error("Message", ex)
}