Developers · Best Practices
Creating Application Logs
Last updated 2 November 2026
This guide shows you how to create logs using the
You can use the
Prerequisites
To follow the steps in this tutorial, you must have the
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
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 stagingThis 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/debugThe system also logs a path that triggers a particular log entry. This way, you can find the cause of the error more easily.