Write log messages from your site's code to record what it does while it runs. Each message becomes an entry on the Logs page in the site dashboard, with a severity level and any extra data you attach.
Important:
console.log() and the other console methods don't write to the Logs page in the site dashboard. Code that runs in the browser still prints console output to the browser's developer tools, but that output isn't saved as a log entry. To write log entries, use the monitoring client from @wix/essentials, as shown in this article.
You can write log entries from backend code, such as HTTP endpoints, event handlers, and service plugins, and from site extensions that run in the visitor's browser. Code in dashboard pages can't write log entries. For more about what gets logged, see About Logs in Studio Two.
The monitoring client writes your log entries. Get it inside the function that runs your code. If you call getMonitoringClient() at the top level of a file, it throws Error: Wix context is not available. In backend code, Wix links each entry to the request that produced it.
To get the monitoring client:
Import monitoring from @wix/essentials:
Inside your function, call getMonitoringClient():
Each call to the monitoring client writes one entry. Log a message to record what your code does, or log an error that your code caught.
Call captureMessage() on the monitoring client with the text you want to log. To set the entry's severity, specify a level. Without a level, the entry is INFO.
Call captureException() on the monitoring client with an error your code caught. The entry is ERROR by default. To set a different severity, specify a level. The entry's message is the error's name and message, such as Error: Payment failed. The entry doesn't include the error's stack trace.
When backend code throws an error that your code doesn't catch, Wix logs it as an ERROR entry automatically. Errors in code that runs in the browser aren't logged unless you catch them and call captureException().
Attach data to an entry so you can tell entries apart when you read them. Both captureMessage() and captureException() accept these options:
tags: Flat key-value pairs with string, number, or boolean values, such as a feature name.contexts: Named groups of related values, such as the details of an order.Tags and contexts appear in the entry's details on the Logs page. Search on the Logs page doesn't match tags or contexts. For how they appear in an entry, see Log Entry Structure in Studio Two.
Caution: Don't log passwords, API keys, tokens, or visitors' personal data. Collaborators who can view your site's logs can read every entry, and forwarded entries leave Wix.
To check your log entries:
Your entries appear in a few seconds. On the Logs page, you can filter entries by severity, search them, and open an entry's full details. For more information, see View Logs in Studio Two.
To add an HTTP endpoint file and call it from a frontend extension, follow the steps in Add an HTTP Endpoint Extension in Studio Two.
The following HTTP endpoint logs each order it receives. If sending the order to a fulfillment service fails, it logs the error and responds with status 502:
Last updated: 2 November 2026