UE_LOG
UE_LOG is a macro that logs a formatted message into the log file.
UE_LOG(<LOG_CATEGORY>, <VERBOSITY_LEVEL>, <TEXT_INFORMATION>);
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 FStringUE_LOG(LogTemp, Warning, TEXT("An Actor's name is %s"), *ExampleActor->GetName());BoolUE_LOG(LogTemp, Warning, TEXT("The boolean value is %s"), ( bExampleBool ? TEXT("true"): TEXT("false") ));IntegerUE_LOG(LogTemp, Warning, TEXT("The integer value is: %d"), ExampleInteger);FloatUE_LOG(LogTemp, Warning, TEXT("The float value is: %f"), ExampleFloat);FVectorUE_LOG(LogTemp, Warning, TEXT("The vector value is: %s"), *ExampleVector.ToString());Multiple SpecifiersUE_LOG(LogTemp, Warning, TEXT("Current values are: vector %s, float %f, and integer %d"), *ExampleVector.ToString(), 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
|