Changing log level verbosity in code not updated and results in crash

Below code at present will show UE_LOG’s up to Verbose, however if declared “LogMyGame” category in “Architecture.h” header is changed to “Warning” (changing either DefaultVerbosity or CompileTimeVerbosity parameter) you are supposed to see logs up to warnings but not Verbose logs.

starting PIE will print Verbose log even though you change log level. and will likely result in crash.
However if UE Editor and VS are closed, it will work just fine. so the problem is that changing log level verbosity and recompiling will not be updated and reflected when starting PIE.

Test project name: “Architecture”

Primary game module:
Architecture.h


#pragma once

#include "CoreMinimal.h"

//General Log
DECLARE_LOG_CATEGORY_EXTERN(LogMyGame, Verbose, All);

Architecture.cpp


#include "Architecture.h"
#include "Modules/ModuleManager.h"

IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, Architecture, "Architecture" );

//General Log
DEFINE_LOG_CATEGORY(LogMyGame);

Sample function somewhere in the project that calls UE_LOG, showing only those, depending on verbosity level specified in primary game module.



#include "LoggingPawn.h"
#include "Architecture.h"

void ALoggingPawn::ShowLog()
{
    //UE_LOG(LogMyGame, Fatal, TEXT("Fatal LogMyGame"));
    UE_LOG(LogMyGame, Error, TEXT("Error LogMyGame"));
    UE_LOG(LogMyGame, Warning, TEXT("Warning LogMyGame"));
    UE_LOG(LogMyGame, Log, TEXT("Log LogMyGame"));
    UE_LOG(LogMyGame, Verbose, TEXT("Verbose LogMyGame"));
}

If you for example change in Architecture.h from this


DECLARE_LOG_CATEGORY_EXTERN(LogMyGame, Verbose, All);

to this:


DECLARE_LOG_CATEGORY_EXTERN(LogMyGame, Error, All);

recompile and start PIE the change will not be reflected, log will show Verbose logs even though you set “Error” verbosity and will usually but not always result in crash.

Do I do something wrong or is this a bug?

the 2nd param is the DefaultVerbosity, but you need to change the 3rd one, CompileTimeVerbosity, to lower log level (All means include even VeryVerbose)