The UE_LOG macro does not display the message in the log window

I have a problem. I used a macro in the code that should output text in the Output Log window. But this does not happen under any circumstances.

What I was doing:

  1. Wrote the code:
    void AMyActor::BeginPlay()
    {
    Super::BeginPlay();
    UE_LOG(Log Temp, Display, TEXT(“Hello Unreal”));
    }

  2. Then I went to the anrial using the Local Windows Debugger

  3. Then I opened the log window and clicked the “Play” button in Unreal

  4. The Display logging category with the text “Hello Unreal!” is not displayed in the log. I don’t understand what I’m doing wrong. I searched with the help of a filter, too, was not found.

Please tell me how to solve this problem.

Below are the screenshots:


_ayPd0XZmDg

1 Like

And are you sure the code is actually being called? Try to put breakpoint there first.
You have to have instance of AMyActor in the level so the BeginPlay gets called.

Hi there @JuliaKurag,

This topic has been moved from International to Programming & Scripting: C++.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing!

Happens for me, too, in the gameplay ability system. Just stepped through a part that should output some logging message (“ability failed”), but nothing shows up.

The code you shared above:

is not valid, LogTemp should be one word together but you put a space between them. If you put a log category that doesn’t exist then probably nothing will get logged. LogTemp is the name of a default log category that programmers can use when they don’t have their own log category defined.

This is what it should look like:
UE_LOG(LogTemp, Display, TEXT(“Hello Unreal”));

More info about LogTemp and log categories

It’s called LogTemp because it’s supposed to be only for log lines that you put in the code temporarily and remove at a later time. But there’s of course nothing stopping you from using it indefinitely :smile:

If you’re interested in creating your own log category, they’re usually named something like Log[module or projectname], so for a project named “Foobar” it would be a convention to create a log category called LogFoobar. Each module can of course have multiple log categories depending on what you need.

In your ProjectName.h:
DECLARE_LOG_CATEGORY_EXTERN(LogFoobar, Display, All);

In your ProjectName.cpp:
DEFINE_LOG_CATEGORY(LogFoobar)

(you can put these in any .h/.cpp btw)

Then to use it:
UE_LOG(LogFoobar, Display, TEXT(“Hello Unreal”));

A reason to create your own log category would be because it allows you to filter out log lines from that category specifically, or even mute them at runtime. To see more things you can control at runtime you can write log into the console and check the output log for instructions.

Plugins should always declare their own log categories, but for your own game it’s totally up to you and you can just keep using LogTemp if you don’t really care about all this.

1 Like