SpatialOS Logging

Output logging

The SpatialOS-specific output logs are enabled by default. However, you can use the Unreal Editor’s Window menu to enable and disable them. You do this in the same way that you use the Window menu to enable and disable Unreal output logs.

The Window menu in Unreal Editor

You can see the log in a SpatialOS Output log window, which is in addition to the Output Log window.

The SpatialOS Output log window

Writing to the SpatialOS output log

The GDK plugin includes a SpatialStatics.h header file. This file has a LogCategory named LogSpatial that you can use to write to the SpatialOS log via the SpatialOS Runtime. This logging applies to local and cloud deployments for both native Unreal and SpatialOS networking.

The log is displayed in the SpatialOS output log window, and stored in the launch.log and runtime.log files at <ProjectRoot>/spatial/logs/localdeployment/timestamp/launch.log and <ProjectRoot>/spatial/logs/localdeployment/timestamp/runtime.log respectively.

For example:

// Load the correct map based on the GSM URL
UE_LOG(LogSpatial, Log, TEXT("Welcomed by SpatialOS (Level %s)"),*GlobalStateManager->DeploymentMapURL);

// This log category will always log to the spatial runtim and thus also be printed in the SpatialOutput
DECLARE_LOG_CATEGORY_EXTERN(LogSpatial, Log, All);

How to filter the log output

You can choose the verbosity level that displays in the SpatialOS output log window and into the launch.log file. The options match those for Unreal Engine logging (Fatal, Error, Warning, Display, Log, Verbose, Very Verbose). Your choice of settings must be the same or less detailed than are set for the Unreal Engine. You can adjust the level using the SpatialOS Runtime settings panel.

Log settings in the Runtime settings panel

We recommend minimizing SpatialOS logging as it increases the load on the SpatialOS Runtime and negatively impacts its performance.

You can also search and filter the logs by the log category or via the unique, GDK-generated name of the worker instance. This name includes a reference to the worker type (such as Client for client-worker instances) to help you identify it.

Filter and search via the log window

SpatialOS logs with Blueprints

You can use the Blueprint node PrintStringSpatial as a helper node to access the LogCategory named LogSpatial and write to the SpatialOS log. The resulting log data displays in the UE Output Log window and the SpatialOS Output log window.

You can also call PrintStringSpatial to circumvent the verbosity checks that apply to native UE_LOGs:

Example usage of PrintStringSpatial

The following image shows the logging output from the Blueprint above. You can see the logs produced by the PrintStringSpatial helper in the SpatialOutput tab at the bottom of the Unreal Editor. The logs additionally print into the top left of the game client window:

Log output as seen in the Unreal Editor


2020-01-15 Page added with full editorial review

Updated about a year ago


SpatialOS Logging


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.