Skip to content

Logging

iTwin Studio recommends utilizing iTwin.js Logger. See iTwin.js article on logging.

iTwin Studio will initialize iTwin.js Logger for every session.

By default, iTwin Studio will write all trace, info, warning, and error logs to a file. This behavior can be further configured by apps setting custom log levels using the Logger.setLevelDefault() or Logger.setLevel() methods during the app’s initialization.

The logging levels can be configured by modifying the logs.config.json file located in the Studio preferences folder. This file allows you to set the default logging level and specify different logging levels for various categories. Note that you need to restart iTwin Studio after modifying the file for the changes to take effect.

By default, the logs.config.json file can be found in the following paths based on your operating system:

- Windows - %AppData%/Bentley/iTwin Studio
- Linux - $XDG_CONFIG_HOME/Bentley/iTwin Studio or ~/.config/Bentley/iTwin Studio
- MacOS - ~/Library/Application Support/Bentley/iTwin Studio

You can run the command iTwinStudio paths and look for the iTwinStudioLoggingConfigPath path to find the configuration file.

Structure of logs.config.json

The logs.config.json file should have the following structure:

{
"defaultLevel": "Warning",
"categoryLevels": [
{
"category": "iTwinStudio",
"logLevel": "Warning"
}
]
}

defaultLevel: This sets the default logging level for all categories that are not explicitly specified. Possible values are Trace, Info, Warning, Error, and None. categoryLevels: This is an array of objects where each object specifies a logging level for a particular category.

  • category: The name of the logging category.
  • logLevel: The logging level for the specified category. Possible values are Trace, Info, Warning, Error, and None.

For more details about the configuration file, check the itwinjs documentation.

By default, all warning and error levels will be printed to the console as well. You can modify this behavior by using the --verbose {level} or --silent CLI flags. Run iTwinStudio.exe --help for a detailed explanation of these flags. Additionally, when running iTwin Studio in developer mode, backend and frontend logs are aggregated into the root process in your VS Code debug console.

Note that some CLI commands (help, versions, paths) will always print their result to console, even when -s is used.

Logs for enabled categories and levels will always be written to file. Logging file structure:

- {app-id} // Each app will have a separate folder
- {app-id}.{date}{number}.log
- default // CLI command logs

In most cases, {app-id} log folder will contain all the information relevant for troubleshooting apps.

Log files can be found in the following locations:

Windows:

%LOCALAPPDATA%\Bentley\Logs\iTwinStudio

Linux:

/tmp/iTwinStudio/Logs

MacOS:

$TMPDIR\iTwinStudio\Logs