[Solved] UE_LOG is not working

Following UE4 Cookbook Tutorial - and whatever I do, - can’t get my Log message out. (On screen or Log Output).

MyProjectGameModeBase.cpp

// Copyright Epic Games, Inc. All Rights Reserved.

#include "MyProjectGameModeBase.h"

void AMyProjectGameModeBase::BeginPlay()
{
	Super::BeginPlay();
	UE_LOG(LogTemp, Warning, TEXT("Warning Message...........") );
}

MyProjectGameModeBase.h

// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "MyProjectGameModeBase.generated.h"

    UCLASS()
    class MYPROJECT_API AMyProjectGameModeBase : public AGameModeBase
    {
    	GENERATED_BODY()
    public:
    	void BeginPlay();
    };

Already tried to add macro and use YourLog.

DECLARE_LOG_CATEGORY_EXTERN(YourLog, Log, All);

with

DEFINE_LOG_CATEGORY(YourLog);

-No result.

Are you sure that you are trying to see your Log Message in the Output Log?

You can open it by going to: Window → Developer Tools → Output Log

Now when you press Play, you should see the message in the new opened window.

Are you sure that you are trying to
see your Log Message in the Output
Log?

Yes sir, here Screenshot (same code that was presented), - no messages. :frowning:

I think the problem is that you are not using the Game Mode Base, where the UE_LOG is located.

You can solve this problem by going to you Project Settings (Edit → Project Settings) and selecting Maps & Modes. Here you can see the Default GameMode. Change that to be the MyProjectGameModeBase that you coded and press Play.

1 Like

I also noticed that in your Header File when you are declaring your BeginPlay() function, you are not declaring it as virtual so instead of overriding the Super::BeginPlay(), it hides it. Try declaring it like so:

virtual void BeginPlay() override;

Edit: I also recommend you declaring it under a protected section.

2 Likes

Everything is working now. Many thanks! You’re just a cool person. :slight_smile:

I had the same problem. Turn out that I needed to build (CMD+B on Xcode) after editing the file cpp file.

How a hell you have solved it? I have the same issue

I have the same issue with UE 5, this isn’t solved

4 Likes

I got the same issue, it is not fixed.

Hello!
If you are using VS Code for C++,

  1. Close ‘Unreal’
  2. In VS Code, press Ctrl+Shift+b
  3. select 'yourprojectname’Editor Win64 Development Build and press enter key or mouse left click on it.
  4. After successful build in VS Code, open the Unreal project file again and play it.

Hope this is helpful.

1 Like

Had this after installing 5.3.2 - make sure that Show All is checked in the Output log - not sure how it got unchecked for me, but yeah.

2 Likes

Thanks! This is the only correct answer. Why would this be disabled by default? Makes no sense

This worked for me even though I’m using VS Community 2022. Also, I have UE5.3.2 installed, and my Show All was already checked under Output Log Filters.