Enable output logs for Shipping Build
I have a crash only in an IOS shipping build. I would like to see logging but have not been able to get it turned on in shipping builds. I have scoured the internet and have tried the following suggestions. (The name of my project is Olok and using engine 4.20)
A: Added bUseLoggingInShipping = true; as suggested by //https://answers.unrealengine.com/questions/383407/how-to-log-in-shipping-build-win.html
This gave error...
ERROR: Olok modifies the value of bUseLoggingInShipping. This is not allowed, as Olok has build products in common with UE4Game. [2018.12.20-16.22.43:940]UATHelper: Packaging (iOS): Remove the modified setting or change Olok to use a unique build environment by setting 'BuildEnvironment = TargetBuildEnvironment.Unique;' in the OlokTarget constructor.
I then did what the output suggested and added BuildEnvironment = TargetBuildEnvironment.Unique; in the constructor. But, this gave the error.. ERROR: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Olok\Intermediate\Build\IOS\Olok\Shipping\Launch\Launch.precompiled'.
I gave up on that.
I since analyzed the engine code and found that i could try and set the #define USE_LOGGING_IN_SHIPPING to 1 by adding PublicDefinitions.Add("USE_LOGGING_IN_SHIPPING=1"); in my Olok.Build.cs ModuleRules Constructor. But it gives the error...
/Users/dannydiaz/UE4/Builds/SHEMO/C/Olok/Intermediate/Build/IOS/UE4/Shipping/Olok/Definitions.h(52,9): error: 'USE_LOGGING_IN_SHIPPING' macro redefined [-Werror,-Wmacro-redefined] [2018.12.20-16.34.22:524]UATHelper: Packaging (iOS): #define USE_LOGGING_IN_SHIPPING 1
I have not tried changing the engine code and rebuilding the engine. I don't really want to do that. Is there any other way to do this?
asked Dec 20 '18 at 04:57 PM in Packaging & Deployment
I looked deeper into the code and found that USE_LOGGING_IN_SHIPPING defines out the logging code completely. This means that you must rebuild the engine with the define toggled to 1.
You should be able to achieve this by adding bUseLoggingInShipping into some config file. However, I could never get that to work. There are many build config files and they seem to change overtime with different releases.
So i went straight to the source and modified the flag...
I got it to work by changing and rebuilding UnrealBuildTool
Change... GlobalCompileEnvironment.Definitions.Add("USE_LOGGING_IN_SHIPPING=0"); to GlobalCompileEnvironment.Definitions.Add("USE_LOGGING_IN_SHIPPING=1"); in UEBuildTarget.cs
I also modified Build.h and set the flag there to 1, but i don't think that was necessary to get it working.
You can verify that its set correctly by right clicking your project in visual studio. Then look at the preprocessor defines in the NMake panel. It should list USE_LOGGING_IN_SHIPPING=1 in there. if it is set to 0 there, then try deleting your intermediate directories and regenerate projects.
Follow this question
Once you sign in you will be able to subscribe for any updates here