Logging
Overview
io.Connect Desktop offers a Logger API which enables web apps to create a hierarchy of sub-loggers mapped to app components where you can control the level of logging for each component. You can also route the output of log messages (depending on the logging level) to a variety of targets - the developer console or an external output.
Adding logging to files to your web apps can be helpful in a variety of ways. Having a well-designed and meaningful logging structure in your apps and their components can save a lot of time when debugging an app during development or troubleshooting problems with an app in production.
ℹ️ For details on how to configure and customize the logging mechanisms of io.Connect Desktop, see the Developers > Configuration > System > Logging section.
ℹ️ For details on how to enable logging the
stdoutandstderrstream outputs of native apps, see the Developers > Configuration > System > Logging section.
Configuration
Logging for apps via the io.Connect APIs is disabled by default. To allow it, use the "allowLogging" top-level key in the app definition file:
{
"allowLogging": true
}Location & Output
User apps will log in the respective <app-name>.log file where <app-name> represents the name of your app as specified in its app definition. A separate log file is created for each app that has logging enabled. All instances of an app log to the same file. The app log file will be located in the %LocalAppData%/interop.io/io.Connect Desktop/UserData/<ENV>-<REG>/logs/applications folder on Windows and in the ~Library/Application Support/interop.io/io.Connect Desktop/UserData/<ENV>-<REG>/logs/applications folder on macOS where <ENV>-<REG> represents the environment and region of io.Connect Desktop (e.g., DEMO-INTEROP.IO).
The log file entries are in the following format:
[<date>T<time>] [<logging_level>] [<instance_id>] [<logger_name>] - <log_message>The following example demonstrates an actual log entry:
[2020-03-11T14:27:58.087] [ERROR] [30760_11] [client-list.test-logger] - test-error
at t.error (http://localhost:22080/client-list/desktop-4.8.0.js:1:39269)
at <anonymous>:1:8Available since io.Connect Desktop 9.9
Child windows of web apps opened via the browser native window.open() method can also use the Logger API to create log entries.
The log entries created by child windows are located in the parent app log file. Each log entry by a child app contains specific details about the child app (indication that the log entry was made by a child app, instance ID and URL of the child app) allowing you to easily find and extract the relevant information. The following example demonstrates the shape of an actual log entry by a child app:
[2025-06-16T10:12:12.476] [INFO] [15308_13] [child:15308_14|https://interop.io/] - Log entry by a child app.System Logs
Streaming & Consuming
You can configure io.Connect Desktop to stream the system logs so that they can be consumed by your apps. You can specify the log level and the interval at which the logs to be streamed. Use the "streaming" property of the "logging" top-level key in the system.json system configuration file of io.Connect Desktop to specify the log streaming configuration:
{
"logging": {
"streaming": {
"enabled": true,
"minLevel": "warn",
"interval": 60
}
}
}The "streaming" object has the following properties:
| Property | Type | Description |
|---|---|---|
"enabled" |
boolean |
If true, will enable streaming system log entries. Defaults to false. |
"interval" |
number |
Interval in seconds at which the log entries will be streamed. Defaults to 120. |
"minLevel" |
"error" | "warn" | "info" |
The minimum level of the log entries to be streamed. Defaults to "error". |
To consume the log entries in your apps, you must implement and register an Interop method named "T42.Logs.Listen". This method will be invoked whenever io.Connect Desktop streams the system logs. The method handler will receive an object with an entries property as an argument which holds an array of objects each describing the individual log entries:
const name = "T42.Logs.Listen";
const handler = logs => logs.entries.forEach(e => console.log(e.source, e.logEntry));
await io.interop.register(name, handler);Each log entry has the following properties:
| Property | Type | Description |
|---|---|---|
logEntry |
object |
A LoggingEvent object as described in the log4js-node types. |
source |
"application" | "bridge" | "gw" |
Source of the system log entry. Log entries may come from the io.Connect Desktop app itself, from the internal window management app, or from the io.Connect Gateway. |
Log Files
Available since io.Connect Desktop 9.3
To specify settings for handling the system log files, use the "files" property of the "logging" top-level key in the system.json system configuration file of io.Connect Desktop:
{
"logging": {
"files": {
"onStartup": "archive",
"moveOldTo": "%LocalAppData%/my-org/logs"
}
}
}The "files" object has the following properties:
| Property | Type | Description |
|---|---|---|
"moveOldTo" |
string |
Absolute path pointing to the location where the log files from the previous session (if any) will be moved on startup of io.Connect Desktop. You can use environment variables. Defaults to "%GLUE-USER-DATA%/logs/archive". |
"onStartup" |
string |
Specifies how to handle the log files on system startup. Set to "archive" to archive the existing log files. Set to "delete" to delete the existing log files. Set to "keep" (default) to leave the existing log files intact. |
Capturing Client App Errors
Available since io.Connect Desktop 9.9
To instruct io.Connect Desktop to capture console messages, network request errors, and any unhandled errors originating from your web app, use the "logging" property of the "details" top-level key in the app definition:
{
"details": {
"logging": {
"consoleMessages": {
"enabled": true,
"level": "info"
},
"networkRequestErrors": {
"enabled": true
},
"unhandledErrors": {
"enabled": false
}
}
}
}The captured errors will be logged in the respective <app-name>.log file where <app-name> represents the name of your app as specified in its app definition. The app log file will be located in the %LocalAppData%/interop.io/io.Connect Desktop/UserData/<ENV>-<REG>/logs/applications folder on Windows and in the ~Library/Application Support/interop.io/io.Connect Desktop/UserData/<ENV>-<REG>/logs/applications folder on macOS where <ENV>-<REG> represents the environment and region of io.Connect Desktop (e.g., DEMO-INTEROP.IO).
Capturing these errors is disabled by default. The "logging" property accepts a Boolean or an object as a value. If set to true, all console messages, networks request errors, and unhandled errors will be logged. You can use an object as a value to provide settings for the types of errors you want to capture.
The "logging" object has the following properties:
| Property | Type | Description |
|---|---|---|
"consoleMessages" |
object |
Settings for capturing console messages. |
"networkRequestErrors" |
object |
Settings for capturing network request errors. |
"unhandledErrors" |
object |
Settings for capturing unhandled errors (e.g., unhandled Promise rejections, errors not logged in the console). |
The "consoleMessages" object has the following properties:
| Property | Type | Description |
|---|---|---|
"enabled" |
boolean |
If true, will allow capturing all console messages. Defaults to false. |
"level" |
"trace" | "debug" | "info" | "warn" | "error" |
Sets the level at which to capture console messages. The platform will capture all console messages at the specified level and above. Defaults to "trace". |
The "networkRequestErrors" object has the following properties:
| Property | Type | Description |
|---|---|---|
"enabled" |
boolean |
If true, will allow capturing all network request errors. Defaults to false. |
The "unhandledErrors" object has the following properties:
| Property | Type | Description |
|---|---|---|
"enabled" |
boolean |
If true, will allow capturing all unhandled errors. Defaults to false. |