When developing games in Unreal Engine, having robust debugging tools and detailed logs can make all the difference during testing and shipping. A useful yet often overlooked feature is enabling logging in Test and Shipping configuration. This is achieved by setting the bUseLoggingInShipping
variable to true
in the game’s Target.cs file.
Why Enable Logs in Shipping?
By default, logs are disabled in Test and Shipping builds to optimize performance and minimize output. However, there are scenarios where enabling logs in these builds can be beneficial:
- Debugging: Having access to logs allows you to diagnose issues that occur exclusively in the Shipping configuration.
- Test Automation: Unreal Engine’s automation framework, Gauntlet, heavily relies on logs to compute test results. Enabling logging ensures that critical data is available to evaluate the success or failure of automated tests.
How to Enable Logs in Test and Shipping
To enable logging, follow these steps:
- Open the Target.cs file for your game project. For instance, this file might be named
MyGame.Target.cs
. - Locate or add the
bUseLoggingInShipping
property in the constructor of your target class. - Set the property to
true
as shown below:
public class MyGameTarget : TargetRules
{
public MyGameTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
// Enable logging in test / shipping builds
bUseLoggingInShipping = true;
}
}
- Save the changes and rebuild your project.
Considerations
While enabling logging in Shipping builds is advantageous for specific use cases, it’s essential to weigh the potential trade-offs:
- Performance Impact: Logs can introduce minor performance overhead. Ensure that the logging level is appropriately configured to minimize unnecessary output.
- Security: Logs can sometimes contain sensitive information. Always sanitize logs before enabling them in public builds.