【Unreal Engine】Debugging Techniques with Print String and Output Log

Created: 2025-12-12

Basic debugging techniques using Blueprint's Print String and C++'s UE_LOG macro. Key parameter for overwrite display and Verbosity usage explained.

Basic Debugging Tools

When developing games with Unreal Engine (UE), you'll face problems like "it doesn't work as intended for some reason" or "no error but processing stops."

The most frequently used basic debugging tools for efficiently identifying bug causes are "Print String" and "Output Log." This article explains the basic usage and advanced techniques for these two tools.


Print String Basics and Applications

"Print String" is the most convenient and intuitive debugging technique. A node (Blueprint) or function (C++) that outputs specified strings to the game screen's top-left corner or Output Log.

Usage in Blueprint

In Blueprint, just inserting a Print String node in the middle of processing flow lets you confirm the processing executed or variable values at that point.

Practical Example: Checking Variable Values and Execution Confirmation

Example displaying current velocity and "Jump Executed!" message when character jumps.

// Blueprint execution flow
Event Jump -> Print String (String: "Jump Executed! Current Velocity: " + Get Velocity)
ParameterRoleBest Practice
In StringString to display. Often concatenates variable values.Add prefix to identify which processing it's from (e.g., [Jump]).
Print to ScreenWhether to display on screen.Use for confirmation during running game.
Print to LogWhether to output to Output Log.Use when screen display is distracting or permanent logs are needed.
Text ColorScreen display color.Setting important messages to prominent colors (red, etc.) is convenient.
DurationTime displayed on screen (seconds).Set longer (e.g., 5.0 seconds) when tracing complex processing.
KeyUnique key identifying the message.Messages with the same key are overwritten by newer ones. Very effective for continuous value checking.

Value Tracking with Key

The Key parameter is a feature that makes Print String powerful as a debugging tool. Setting the same Key keeps the screen message updated to the latest value.

For example, when displaying character HP every frame in Tick event, setting a fixed Key value makes HP continuously update in real-time at the screen's top-left. This prevents the screen from being flooded with messages while tracking specific variable changes.


Using Output Log

If Print String is "convenient visual checking," "Output Log" is the debugging heart aggregating information from the entire UE system. Not just messages from Blueprint and C++, but engine warnings, errors, load information—all information is recorded here.

Opening and Basic Operations

Output Log opens from Window > Developer Tools > Output Log at the top of the editor.

  • Filtering: The search bar at the top of the log window displays only messages containing specific keywords (e.g., Error, Warning, MyDebug).
  • Log Categories: UE logs are categorized like LogTemp, LogBlueprint, LogAI, etc. Combined with filtering, extract only needed information.

Logging in C++: UE_LOG Macro

When outputting debug information to Output Log in C++, use the UE_LOG macro. This is the most standard debugging technique in C++ development.

// Define log category (usually use project name, etc.)
DEFINE_LOG_CATEGORY_STATIC(LogMyGame, Log, All);

// Example outputting warning message
UE_LOG(LogMyGame, Warning, TEXT("Player %s took damage. Remaining HP: %f"), *GetPlayerName(), CurrentHealth);

// Example outputting error message
if (TargetActor == nullptr)
{
    UE_LOG(LogMyGame, Error, TEXT("Target actor is Null! Aborting process."));
    return;
}

The second argument of UE_LOG (Warning, Error, Log, etc.) indicates log verbosity (importance).

VerbosityRoleUse Case
ErrorFatal problem. When game continuation is difficult.Required resource load failure, Null pointer reference, etc.
WarningPotential problem. Non-fatal error that should be fixed soon.Deprecated function usage, unexpected input values, etc.
LogStandard information message.Processing start/end, variable value confirmation, etc.
DisplayImportant information that should be displayed to user.When you also want it shown on screen as debug info.

Output to Output Log from Blueprint

Blueprint's Print String node also outputs to Output Log by default (when Print to Log is checked). However, to specify more detailed log categories, it's common to create custom log output functions in C++ and call them from Blueprint.


Best Practices and Common Mistakes

Best Practices

PracticeDetailsEffect
Include context in logsInclude which class, which function, which variable's value in Print String and UE_LOG messages (e.g., [MyActor::Tick] Current HP: 100).Even with many logs, instantly identify which processing it's from.
Use different verbosity levelsIn UE_LOG, use Log for mere information, Warning for problem signs, Error for fatal problems.Output Log filtering is maximally useful, enabling response based on problem urgency.
Use Print String KeyWhen tracking variables in frequently executed processing like Tick or Update, always set Key to keep screen clean.Prevents screen from being flooded with debug messages while enabling real-time value checking.
Prepare debug boolean variablePrepare a boolean variable like bDebugMode in classes to enable/disable complex debug logging, checking before log output.When debugging is complete, disable all log output with one variable, preventing performance degradation in release builds.

Common Mistakes

  1. Ignoring Print String Duration:

    • Mistake: Leaving Duration at default 2.0 seconds, trying to follow messages that disappear instantly.
    • Solution: Set Duration to 5.0 or 10.0 seconds depending on the processing to track, or use Key to persist messages.
  2. Not checking Output Log:

    • Mistake: Relying only on Print String results displayed on screen, missing Warning and Error recorded in Output Log.
    • Solution: Make it a habit to check Output Log Error and Warning filters when processing doesn't work as intended.
  3. Using printf or std::cout in C++:

    • Mistake: Using C++ standard output functions for debugging.
    • Solution: Always use the UE_LOG macro which integrates with UE's framework. This provides benefits of UE's logging system like verbosity settings, filtering, and file output.

Choosing Between Print String and Output Log

Print String and Output Log are the most basic debugging tools in Unreal Engine development, but understanding their usage can dramatically reduce bug-fixing time.

ToolMain UseCharacteristics
Print StringExecution confirmation, real-time variable display on screen.Convenient, intuitive. Value persistence via Key is powerful.
Output LogSystem-wide error/warning monitoring, detailed logging from C++.Persistent, filterable. Understand system depths.

Debugging is part of the development process, and mastering these tools is the first step toward professional engineering. Always question "Did this processing really execute?" "What's this variable's value now?" and make it a habit to verify with Print String and Output Log.