SML Logging

The SML Logging system is an essential resource when developing your mod, especially for Blueprint mods, which can’t be debugged with a debugger like C++ mods.

The messages you log will be recorded to a text file that is automatically submitted when users use Satisfactory Mod Manager to generate a debug log.

The log file will be replaced at every game launch, and if you have multiple copies of the game open, a suffix will be appended to the file name to differentiate them (ex. FactoryGame_2.log)

Viewing Logs

By default, the game’s logs will be stored in \AppData\Local\FactoryGame\Saved\Logs\FactoryGame.log.

You can also view the logs live in a terminal as the game is running. To view the terminal, add -log to the game’s launch arguments. Learn how to configure launch arguments on the FAQ page.

Logging from Blueprints

The Log functions provided by the SML blueprint libraries allow for logging strings, which most types can be converted to.

Strings logged with this function will appear under the LogYourModReference log category, which will be automatically created if it doesn’t exist yet.

Logging from C++

Logging from C++ is usually accomplished via the UE_LOG macro.

This Unreal Engine community wiki page does a good job of explaining how to use the macro, set up your own custom logging categories, and the macro’s formatting capabilities.

An example definition for a log category that matches the name and behavior of SML’s auto-created blueprint logging categories:

In YourModReference.h:

DECLARE_LOG_CATEGORY_EXTERN(LogYourModReference, Verbose, All);

In YourModReference.cpp:

DEFINE_LOG_CATEGORY(LogYourModReference);

In a cpp file where you want to log something:

#include "LogYourModReference.h"
// [...]
UE_LOG(LogYourModReference, Verbose, TEXT("Hello World!"));

When creating a log category with the DECLARE_LOG_CATEGORY_EXTERN macro in your headers, make sure that the compile-time verbosity (the third argument) is set to All.

If the category is named LogYourModReference and has a compile-time verbosity other than All, whenever a blueprint logging call is fired, the engine will attempt to re-create the logging category with the All category, leading to two different verbosity levels being specified for the same logging category, causing the game to hard crash.

The second argument is the default verbosity, whose value does not need to match with SML’s.

Note that if you redefine the blueprint log category (LogYourModReference) with a Default Verbosity other than SML’s value of Verbose, your blueprint logging calls will also be affected be filtered.

As with most C++ macros, making a mistake with the syntax can lead to some messy compile time errors, so compile often when first trying this out to try and catch the mistakes early.

Consider looking at some open source C++ mods for more examples of UE_LOG in practice.

Examples:

Default Behavior

By default, the game will obey the logging verbosity settings configured by CSS, followed by the settings you set in %LOCALAPPDATA%\FactoryGame\Saved\Config\Windows\Engine.ini

With these settings, all mod logging calls will be displayed in the terminal and FactoryGame.log.

Redirect Logs for a Specific Mod

You can use the Unreal Engine LogCategoryFiles launch argument to redirect a specific log category into a separate file. This means that, in addition to appearing in FactoryGame.log, they will appear in a file of your choice.

The path specified in the launch argument is relative to your game install directory, not the Local AppData folder like the default log.

For example, using the argument -LogCategoryFiles="FilteredLogs\LogExampleMod.log=LogExampleMod" will put a LogExampleMod.log file at <your game install path>\SatisfactoryExperimental\Engine\Binaries\Win64\FilteredLogs\LogExampleMod.log

If you want the log file to appear in the same folders as the default FactoryGame.log, you will have to use a full path, for example:

-LogCategoryFiles="C:\Users\YourUsernameHere\AppData\Local\FactoryGame\Saved\Logs\LogSlate.log=LogSlate"

You can group multiple mods into one file with a plus, for example, TODO Arch Example

Change Verbosity for a Specific Mod

You can filter which log messages are output via editing your Engine config file.

From: %LocalAppData%/FactoryGame/Saved/Config/Windows/Engine.ini

[Core.Log]
Global=Warning
LogSML=All
LogGame=Verbose
LogExampleMod=BreakOnLog

You should also be able to use the -LogCmds launch argument, but this has not been tested.

Example: -LogCmds="global warning, SML all"

Redirect your Log File to Another Location

You may wish for your default log file to be stored in a different location or under a different name than the default.

For example, -LOG="GameLogFileLocationOverride.log" will rename your log file, but it will still be located in the default folder location.