UE_LOG in BeginPlay not firing. Bit of a known issue? (Super UE4 noob, no answers on Google.)

Hey all,

Just starting to make the switch from Unity due to a new job, working though the Packt Publishing quick start guide by Rachel Cordone. Not a deal breaker, but getting a small issue.

I’m creating a new C++ class, and in the BeginPlay() method, just below the Super::BeginPlay() call I’m adding the following line:


UE_LOG(LogTemp, Warning, TEXT("OUR C++ CLASS IS WORKING!"));

However, it’s not firing in the output console.

What I’ve tried so far to rectify this solution:

  1. Tried changing the verbosity to ‘Error’.
  2. Tried changing the catergory to LogActor.
  3. Making sure that all messages, warnings, errors (Sepcifically the LogTemp) are all selected.
  4. Delete the C++ class and try to rebuild it to make sure that the compiler wasn’t bugged.
  5. The above caused issues so I redid the whole project from scratch (30-60mins work) and backed up before proceeding.
  6. Tried running in the viewport windows and in a new player/
  7. Adding the same message into the constructor.

None of these attempted workarounds have worked.

Does anyone know why the Log system might not be firing?

I’m hesitant to proceed without the log system working as I’ve found it invaluable when working in Unity for bug testing (not yet started Unit Testing)

I apologise if this is a totally noob issue. I appreciate any and all replies. Many thanks.

Mike

EDIT: I’m using Version 4.22.3-7053642+++UE4+Release-4.22

1 Like

Log definitely works. Check your Output window. You can also just place a breakpoint on that line in your class and attempt to step over it. You may want to create your own log category and try using that. Just add the following line to your code somewhere (normally in MyGamePrivate.h).



#include "Logging/LogCategory.h"
#include "Logging/LogMacros.h"

DECLARE_LOG_CATEGORY_EXTERN(LogMyGame, Log, All);

// To use it
UE_LOG(LogMyGame, Warning, TEXT("This is a simple log statement."));


Hi @ExtraLifeMatt ,

Many thanks for the quick reply.

First off. The blasted thing is working… but all I did was go and have dinner. I had already tried reloading the editor, but not restarting the PC, this is the only thing I can think of that got it working (feeling kinda dense 'cos I worked as a systems support tech for several years and the old “Try turning it off and on again” was the goto first response.)

Yes,you’re right it absolutely does… but wasn’t for me and the time. But it is working now - complete with the correct yellow and red colours for warnings and errors, respectively.

Yup, was doing that. The book I’m working from tells you where to find that window and I was checking that regularly and pulling my hair out as the code was the same on screen as in the examples. Plus I checked the code I had on screen with various wiki’s and guides - no luck. No idea what was not working, but it is now! XD

I didn’t get this far through your recommendations before it worked. This file MyGamePrivate.h… which script is this? Asking for future reference…

All in all, this post of mine was pointless because it sorted itself out… but I still really appreciate your time and efforts Matt. Don’t worry, I shouldn’t be posting here TOO frequently with noob questions.

All the best, and many thanks,

MIke.

TLDR;
RESTART THE PC, NOT JUST THE EDITOR!!!

It’s not a script, it’s a header file. If you start a C++ Project, you pick a name for your Project - which Unreal then pre-populates with various files. The MyGamePrivate.h is one of those files, except replace “MyGame” with whatever you named your project.

2 Likes

@ExtraLifeMatt - You are a star.!!! Many thanks for your help.

1 Like