How to add "bUseLoggingInShipping" to my Project?

Hello UE Users :slight_smile:
Iam competly new to C++, i only work with blueprints but my game crashes after i packaged it and in the editor its working perfectly…
I generated all project files and have now some .cs files in my Project Folder, but in which file i have to add this code?:

UEBuildConfiguration.bUseLoggingInShipping = true;

I need it to find the problem why my game crashed, i hope someone can tell me the filename to insert this code :o
Thank you :)!

Hi @Sky001, to use that build option, you must first have a source build of the engine on your PC. It will not work at all without it. Get it, compile it in Development Editor mode (with all the utility programs) before continuing.

Once you have done that, you put that line of code, plus some other options, into the yourproject.Target.cs file in the source folder of your project. This is what mine looks like:

YourProject.Target.cs



// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;
using System.Collections.Generic;

public class YourProjectTarget : TargetRules
{
    public YourProjectTarget(TargetInfo Target): base(Target)
    {
        Type = TargetType.Game;

        //Use these config options in shipping to enable logs, and to enable debugger.
        if (Configuration == UnrealTargetConfiguration.Shipping)
        {
            BuildEnvironment = TargetBuildEnvironment.Unique;
            bUseChecksInShipping = true;
            bUseLoggingInShipping = true;
        }

        ExtraModuleNames.AddRange(new string] { "YourProject" });
    }

}



Then, next time you package it in Shipping mode, not only will you get the logs, but you will be able to attach a visual studio debugger to the shipping binary as well. Hope this helps.

4 Likes

Thank you ! :slight_smile: this helps!