Log Message not printed

Sir I wrote this code for printing on log screen
UE_LOG(LogTemp,Warning,TEXT(“Yellow Text”));
It Is Not Giving Any Errors But Nothing Gets Printed on LogOutput

Hey -

Where exactly are you checking your logs for your message? I copied the code you provided into an actor tick function and got the LogTemp warning printed to the output log during PIE. Can you explain exactly what you’re doing?

I Wrote This Code In Begin Play() Is it Wrong???

Yes I Was Looking At The Output Log In The Editor
The Warning Message is Still Not Showing

Are you looking at the output log in the editor after pressing play? Even in BeginPlay() the warning message is appearing in my project.

Do you actually have this code in the scene… i.e. if it’s a class that extends Actor, have you actually dragged the Actor into your map, or if it’s an ActorComponent is it on another Actor?

How have you got things setup?

I can’t directly as I don’t know what base class you are extending from. Has the code been added to existing code? Is it a new class you have created? etc

As a test you could create a new C++ class in the ContentBrowser, choose to extend from Actor. Then drag this from the ContentBrowser into your scene. Then open the C++ code and add the UE_LOG line into the ::BeginPlay() function.

Actually I am New to Unreal Engine So Can U Please Tell Stepwise Procedure To Follow

I Created A New C++ Class Named PositionReport2 Chose Actor class
In The C++ Code Added the UE_LOG line but when i drag this from content browser to my scene The Engine Crashes

Thanks I Solved that Problem
Do We Have to Drag Everytime Before We play to Get Yellow text???

and i wrote this code for determining position but its not showing on output log

FString ObjectName = GetOwner()->GetName();
FString ObjectPos = GetOwner()->GetTransform().GetLocation().ToString();

UE_LOG(LogTemp, Warning, TEXT("%s is at %s"), *ObjectName, *ObjectPos);

This should work fine, if the engine is crashing i’m guess it is something else within the project. I did a quick test, see images…

This class is extending the AActor class which has all the functionality required to get the Transform etc, so you can probably use the ‘this’ keywork instead of GetOwner().

try something like:

FString ObjectName = this->GetName();
	FString ObjectPos = this->GetTransform().GetLocation().ToString();
	UE_LOG(LogTemp, Warning, TEXT("%s is at %s"), *ObjectName, *ObjectPos);

Infact, you probably don’t even need the ‘this->’ before GetName() and GetTransform().

No, you shouldn’t need to drag it in each time. Once it’s in your map and it’s saved it should always be there, unless you are instantiating it at runtime, in which case it’ll still be there and BeginPlay() will still be called.

Thanks …What is The Difference Between This and GetOwner()???
Whenever I Use Getowner() the Engine Crashes while in Your code It worked nicely Is there Any Reason To That???
And In The Log Output It Is Always Showing X=0,Y=0,Z=0,How To Change That???

this* is pointer to “Self” while GetOwner() return pointer to owner, which might be nullptr if you not specified owner on actor spawning to level.

0,0,0 is the Actor’s position within your map (this is what you wanted to output).

Select the Actor in WorldOutliner and lookat the Transform section of the details panel… is it at 0,0,0?? Try dragging it to a new location and playing again.

Actually Whenever I Drag It Goes To Some Position I Dont Know and When I Click Play It Says X=0 Y=0 Z=0, What I wanna Do Is Whenever I select any Object (for example chair) it shows me the position of it

I’m getting the same issue …I take a sphere and assign a actor c++ class…but the message is not showing in log.
I’m following the gamedev.tv C++(BuldingEscape) tutorial.