How to log in shipping build (Win)?

Just for the record, I set that flag to 1 in the aforementioned H file and spend all day getting this engine to compile and run with my project and create a packed shipping version of my project and NADA! Zip, Zilch.
No logfile is created.

Seriously this is an ESSENTIAL feature. How else do you expect us to find errors on a client’s machine when there is no logfile? What were your people thinking when they decided that logfiles are useless as a tool to find errors?

1 Like

I am experiencing this issue as well. I set USE_LOGGING_IN_SHIPPING to 1, then rebuild a huge part of the engine, but when I run the standalone shipping game there is no log file. Could this be a bug or is there something else that we need to set up?

Thanks,

Franco

I finally got it going based on this thread.
NOTE THE LAST PASSAGE IN THAT POST:

Philippe32: Good thing to know for
future Googlers, for shipping builds,
save games and log files go in
C:\Users\UserName\AppData\Local\GameName

The logfile will not go in your game directory, but into this fixed location!

So I am just reporting this here in order to make it a more complete answer. Generally changing the UEBuildConfiguration.cs or USE_LOGGING_IN_SHIPPING directly in engine is less than the desired usage. Though it may be changing things for the better in one case it is better to set variables in your target files like so:

public override void SetupGlobalEnvironment(TargetInfo Target,
           ref LinkEnvironmentConfiguration OutLinkEnvironmentConfiguration,
           ref CPPEnvironmentConfiguration OutCPPEnvironmentConfiguration
           )
    {
        OutCPPEnvironmentConfiguration.Definitions.Add("USE_LOGGING_IN_SHIPPING=1");
        UEBuildConfiguration.bUseLoggingInShipping = true;
    }
2 Likes

Everything before your post is a chronicle of people not finding the solution. Your post is the solution. You should put it in a separate answer and it should be marked as correct. All I can do is up-vote your post.

Hi, did you get this to work? I have tried adding this to my games target file and it still doesn’t use logging in shipping.

You have to change this in the UE4Game.Target.cs (or Client/Editor/Server or all depending on your needs) in the UE4 engine source code.
You need to build the engine from source with these options for the engine to support logging in the shipping build.

With 4.18, you can just add “bUseLoggingInShipping = true;” to the TargetRules constructor in your Target.cs file.

do i need to add this in my “MyGame”.Target.cs ?and is this possible for the engine from the launcher or only for source builds of the engine?

Thanks in advance,

Yes and I think it should but I use the source-built engine so I can’t say I’ve tried it.

Update: I was a bit mistaken. The answer above was updated to the correct flag to set. I originally said it was Target.bUseLoggingInShipping but it’s in the TargetRules, not the TargetInfo. I’m building something now to make sure it works but it will be a while (full rebuild) so I thought I’d get this correction up now.

Ya. It works. Doesn’t seem to show my PrintString calls though. Just the C++ log calls.

Additionally, with the new *.Target.cs option (see my answer), it still forces a full rebuild. Even if I only change MyServer.Target.cs, it causes the client to be rebuilt from scratch.

Also, I have noticed that this option only lets the UE_LOG messages through. BP “PrintString” nodes are not displayed. Personally, I call that a bug – or maybe a missing feature (another option we can set in TargetRules). The work-around is to expose a C++ function to BPs so they can call into it and perform a UE_LOG, but it should be easier IMO.

@Wallenstein this fight between shipping and development is always an issue but I totally understand why hoops need to be jumped through. Debugging information embedded in print statements generates massive binaries and needs to be removed from the binaries. Every AAA project I’ve worked on has always had this issue. Perhaps one day we’ll be at a point where machines and download/load speeds are so powerful that we just don’t care but it seems likely that for a long time yet a project that takes care to remove this data will significantly out perform a project that doesn’t.

On rebuild step 16/1445 here so I feel your frustration!

I’d be suspicious if a full rebuild wasn’t needed (though perhaps for non source builds Epic could provide a log enabled shipping build to link against).

You should add a bug report about the Blueprint functionality - seems like a valid concern.

trying this, I got errors on package. basically none of the Log categories are defined. 4.18.3

Weird. It works for me. Did it do a full rebuild? Did you put it in the right place? Maybe it only works with projects set up for IWYU headers. I don’t know.

Apparently you just can’t use LogTemp in a shipping build, that was the only one undefined actually. But that is a separate issue.

While this works as promised in 4.18+, this does not allow packaging if you are using a Launcher Build.
It fails with:

ERROR: Missing precompiled manifest for ‘Launch’. This module was most likely not flagged for being included in a precompiled build - set ‘PrecompileForTargets = PrecompileTargetsType.Any;’ in Launch.build.cs to override.

No idea where the Launch.build.cs is and if that would fix anything, so if you want to do this you are most likely still locked to a Source Build. If you have a Source Build already though, you luckily don’t have to modify it anymore with above’s answer.

There is Conclusion but seems complex to annonymous.

  1. Cant Use Launcher Engine, you need to get open source built engine from github

  2. When you get source engine, fix the unreal engine source file

311519-1.png

  1. now switch engine version of your game project and regenerate sln

  2. add use logging code to your project target cs file

now package again

you can get log file from desktop location, not a build file location

1 Like