The log component

A Component to log a message to the Servers STDOUT or Log file on page load

Top-level parameters

name required type description
message REQUIRED

TEXT

The message that needs to be logged
priority

TEXT

The priority which the message should be logged with. Possible values are ['trace', 'debug', 'info', 'warn', 'error'] and are not case sensitive. If this value is missing or not matching any possible values, the default priority will be 'info'.
No data

Examples

Hello World

Log a simple 'Hello, World!' message on page load.

SELECT 'log' as component,
        'Hello, World!' as message

Output example:

[2025-09-12T08:33:48.228Z INFO  sqlpage::log from file "index.sql" in statement 3] Hello, World!

Priority

Change the priority to error.

SELECT 'log' as component,
        'This is a error message' as message,
        'error' as priority

Output example:

[2025-09-12T08:33:48.228Z ERROR sqlpage::log from file "index.sql" in header] This is a error message

Retrieve user data

set username =  'user' -- (retrieve username from somewhere)

select 'log'							  as component,
        '403 - failed for ' || coalesce($username, 'None') as output,
        'error'							  as priority;

Output example:

[2025-09-12T08:33:48.228Z ERROR sqlpage::log from file "403.sql" in statement 7] 403 - failed for user

See also: other components