Message Log

From UE4: Community Wiki
Jump to: navigation, search


This article is a preliminary version, it is subject to change.


The Message Log window

The Message Log is a way to display logs to the user in editor and in the output log at the same time. The messages display in the Message Log can react to user interaction by integrating Links to Objects, Blueprints, Assets and more. These messages are displayed in the "Message Log" window available at Window > Developer Tool > Message Log and are organized in multiples categories. Useful for artists and Level designer to have quick feedback on the level configuration.


For Output Log logging with UE_LOG see Logging


This articles describe the way to use the Message Log system in order to display messages to the user in the editor.

Terms and Structure[edit]

The Message Log system rely mainly on the FMessageLog class and the FMessageLogModule module.

A message is an instance of a FTokenizedMessage created and added in a Message Log category. This category is defined by the FMessageLog instance used to create each message.

Messages could be included in a Page. After the declaration of a page, each following messages are included in it. Most of the time, a new pages means a cleaning of old messages and a starts of a new sequence of messages.

These messages and pages are displayed in the Message Log window in Log Listings. Each listing is associated with a log category and are declared with the FMessageLogModule module. A listing can be configured to allow page selection, clearing, message filtering and more.

Logging with Message Log[edit]

In this section, you will discover how to use the Message Log in your code to display rich messages in the editor's Message Log window. To keep this section focused on logging we will make use of FText::FromString() but you must use LOCTEXT() in a production project.

Simple logging[edit]

All messages must be created from an instance of FMessageLog. This instance is created by giving the contructor a single FName containing the log category where you want to send your log message.

// You need the following include at the beginning of the file
// Logging/MessageLog.h contains the declaration of FMessageLog
#include "Logging/MessageLog.h" 

//...

// All messages created with this instance will be flushed to the "Play in Editor" log category listing in the Message Log window
FMessageLog PIELogger = FMessageLog(FName("PIE"));

See "Editor Log Categories" for a full list of the available log categories or "Log Listing creation" to create your own listing

Now, you can send your messages to this category using the Info(), Warning(), PerformanceWarning(), Error() or CriticalError() methods depending of the severity if the message. All these methods only takes a single FText containing the content of the message to display.

CriticalError() method is used for fatal errors and will crash your editor/game if used. Use it in case you can't allow your game to run with this error occured.

Log messages in the Message Log window
PIELogger.Info(FText::FromString("Informationnal message"));
PIELogger.Warning(FText::FromString("Warning message"));
PIELogger.PerformanceWarning(FText::FromString("Warning message about performace issue"));
PIELogger.Error(FText::FromString("Error message"));

You can also use the Message() method and specify the severity of it with the EMessageSeverity::Type enum.

PIELogger.Message(EMessageSeverity::Type::Warning, FText::FromString("Enum defined Warning message"));

Messages are stored inside the FMessageLog but not flushed to the Message Log system before the instance destruction. You must destroy the instance to send all messages declared with it. It isn't recomanded to keep an instance of FMessageLog too long, keep it simple, just create a new instance in the current scope when you need to log something ant let it be destroyed at the end of the scope.


For an easy and unified access to your logger, you can create a single header file named like MyAwesomeLogger.h containing two defined macros.

#pragma once
#include "Logging/MessageLog.h" 

#define MY_AWESOME_LOGGER_LOGNAME FName("LogCategory")

#define MY_AWESOME_LOGGER FMessageLog(MY_AWESOME_LOGGER_LOGNAME)

MY_AWESOME_LOGGER_LOGNAME is used to define the log category, you will need this name if you want to create your own log listing (see "Log Listing creation"). And MY_AWESOME_LOGGER can be used to get a single instance of FMessageLog.

Now, you just have to call MY_AWESOME_LOGGER in your code and no longer needs to define the log category every time you needs to log something.

MY_AWESOME_LOGGER.Warning(FText::FromString("Warning message"));

Of course, don't forget to include your MyAwesomeLogger.h everywhere you needs to use your macros.



Rich Logging[edit]

Explain how to do a tokenized logging using FTokenizedMessage


Log Listing creation[edit]

This section assumes that you know what is a Game Module and already have one configured with a module class.


Explain how to create a custom Log Listing with FMessageLogModule


Editor Log Categories[edit]

Below, the list of all Unreal Engine defined log categories and their associated listings in the editor window.

Log Category Log Listing Label Notes
AssetTools Asset Tools
AutomationTestingLog Automation Testing Log
LocalizationService Localization Service
SourceControl Source Control
AnimBlueprintLog Anim Blueprint Log
UDNParser UDN Parse Errors Not shown in the Message Log window
BlueprintLog Blueprint Log
BuildAndSubmitErrors Build and Submit Errors
TranslationEditor Translation Editor
EditorErrors Editor Errors
LoadErrors Load Errors
LightingResults Lighting Results A new page is created before and after each new lightning build
PackagingResults Packaging Results
MapCheck Map Check
AssetCheck Asset Check
SlateStyleLog Slate Style Log
PIE Play In Editor A new page is created before each Play in Editor session
AssetReimport Asset Reimport
CompilerResultsLog Compiler Log A new page is created before each compilation
BlueprintCompiler or
[Blueprint GUID]_[Blueprint Name]_CompilerResultsLog
BlueprintCompiler A new category can be created for each blueprint compilation
Not shown in the Message Log window

This table was created based on a search of .RegisterLogListing( in the editor's source code. Last update 10th June 2020.

See also[edit]