UE_LOG in Unreal Engine
How to print any info to the Output Log in the Unreal Engine?

UE_LOG
UE_LOG is a macro that logs a formatted message into the log file.
UE_LOG(<a href="#log_category"><LOG_CATEGORY></a>, <a href="#ELogVerbosity" target="_blank"><VERBOSITY_LEVEL></a>, <a href="#info"><TEXT_INFORMATION></a>);Sample:UE_LOG(LogTemp, Display, TEXT("Hello World"));UE_LOG Properties
LOG_CATEGORY
Default categoryLogTempCustom categoryDeclaration in header file
sample:DECLARE_LOG_CATEGORY_EXTERN(<LOG_CATEGORY>, <VERBOSITY_LEVEL>, All);DECLARE_LOG_CATEGORY_EXTERN(MyEditorCategory, Log, All);Definition in cpp file
sample:DEFINE_LOG_CATEGORY(<LOG_CATEGORY>);DEFINE_LOG_CATEGORY(MyEditorCategory);Logging from anywhere in the code
sample:UE_LOG(<LOG_CATEGORY>, <VERBOSITY_LEVEL>, Text_info);UE_LOG(MyEditorCategory, Warning, TEXT("Unable to add content browser status branches, none specified"));Declare custom category
ELogVerbosity
Value Description Printed in Console Printed in Editor Log Text Color NoLoggingNot used FatalAlways prints a fatal error to console (and log file) and crashes (even if logging is disabled) Yes NA NA ErrorPrints an error to console (and log file). Yes Yes Red WarningPrints a warning to console (and log file). Yes Yes Yellow DisplayPrints a message to console (and log file) Yes Yes Grey LogPrints a message to a log file (does not print to console) No Yes Grey VerbosePrints a verbose message to a log file (if Verbose logging is enabled for the given category, usually used for detailed logging) No No NA VeryVerbosePrints a verbose message to a log file (if VeryVerbose logging is enabled, usually used for detailed logging that would otherwise spam output) No No NA All= VeryVerbose NumVerbosityVerbosityMask= 0xf SetColor= 0x40 BreakOnLog= 0x80 TEXT_INFORMATION
Data Type Example FString<span UE_LOG(LogTemp, Warning, <span class="cc_yellow">TEXT</span>(<span class="cc_green">"An Actor's name is %s"</span>), *ExampleActor-><span class="cc_yellow">GetName</span>());Bool<span UE_LOG(LogTemp, Warning, <span class="cc_yellow">TEXT</span>(<span class="cc_green">"The boolean value is %s"</span>), ( bExampleBool ? <span class="cc_yellow">TEXT</span>(<span class="cc_green">"true"</span>): <span class="cc_yellow">TEXT</span>(<span class="cc_green">"false"</span>) ));Integer<span UE_LOG(LogTemp, Warning, <span class="cc_yellow">TEXT</span>(<span class="cc_green">"The integer value is: %d"</span>), ExampleInteger);Float<span UE_LOG(LogTemp, Warning, <span class="cc_yellow">TEXT</span>(<span class="cc_green">"The float value is: %f"</span>), ExampleFloat);FVector<span UE_LOG(LogTemp, Warning, <span class="cc_yellow">TEXT</span>(<span class="cc_green">"The vector value is: %s"</span>), *ExampleVector.<span class="cc_yellow">ToString</span>());Multiple Specifiers<span UE_LOG(LogTemp, Warning, <span class="cc_yellow">TEXT</span>(<span class="cc_green">"Current values are: vector %s, float %f, and integer %d"</span>), *ExampleVector.<span class="cc_yellow">ToString</span>(), ExampleFloat, ExampleInteger);
UE_LOGFMT
UE_LOGFMT records a structured log event that supports Positional or Named parameters but can not mix both styles. To use this macro you, need to include the Logging/StructuredLog.h library declaration.
UE_LOGFMT was introduced with Unreal Engine 5.2.
| Parameter Name | Description |
|---|---|
| Positional | When using positional parameters, the field values must exactly match the field referenced by format. For example: |
| Named | When using Named parameters, the field values must contain every field reference by format. The order is irrelevant and extra fields are permitted. For example: Field names must match the "[A-Za-z0-9_]+" format and must be unique within this log event. Field values are serialized using SerializeForLog or the operator
|


