Skip to content

Developers · Best Practices

Creating Application Logs

Last updated 2 November 2026

This guide shows you how to create logs using the Liquid tag. This tag lets you print any information to application logs as type info, debug, error, or a type you specify and list them in your console next to your sync.

You can use the tag in any file that accepts Liquid so that you can use them in Pages, Layouts, Partials, Permissions, async callbacks, etc.

Prerequisites

To follow the steps in this tutorial, you must have the installed, an environment configured, and the codebase set up. You must also understand concepts such as Pages, Templates, and the technologies behind Insites, particularly Liquid and GraphQL.

Steps

Creating application logs is a two-step process:

  • Step 1: Using the 'log' Liquid tag
  • Step 2: Starting the code logging process

Step 1: Using the 'log' Liquid tag

Create a page using the Liquid tag, and sync it.

app/views/pages/log-test.liquid

{% liquid
  log "This is a message"
  log params, type: "request-params"
  log "This will be an error", type: "error"
%}

Notes

  • You can print any object to the logs.
  • You can use parameters (e.g. take parameters from the URL and include them in the message).
  • The log entry  can be any string you want to use to tag your entry.
  • If you chose , insites-cli marks it red and tries to notify your operating system (OS).

Step 2: Starting the code logging process

In your command line, enter the command to start live logging:

[user@host] $ |insites-cli logs staging

This command pulls the logs from the server every few seconds and displays them in your command line.

Example

[2020-04-23 14:53:24.998Z] - info: This is a message
path: /test/logs/debug
[2020-04-23 14:53:25.094Z] - request-params: {"slug":"test","slug2":"logs","slug3":"debug","format":"html"}
path: /test/logs/debug
[2020-04-23 14:53:25.116Z] - error: This will be an error
path: /test/logs/debug

The system also logs a path that triggers a particular log entry. This way, you can find the cause of the error more easily.