# How do I log a simple string?

**URL:** <https://forums.unrealengine.com/t/how-do-i-log-a-simple-string/969>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [March 26, 2014, 12:02am UTC](https://forums.unrealengine.com/t/how-do-i-log-a-simple-string/969 "2014-03-26T00:02:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![maikklein](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/maikklein/32/918666_2.png) [@maikklein](https://forums.unrealengine.com/u/maikklein)\
**Post date:** [March 26, 2014, 12:02am UTC](https://forums.unrealengine.com/t/how-do-i-log-a-simple-string/969/1 "2014-03-26T00:02:27Z")

</div>

I am not sure how to log a simple string. I found the UE\_LOG macro but it is not obvious to me how to use it.

---

<div class="post-metadata">

**Author:** ![Matt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Matt](https://forums.unrealengine.com/u/Matt)\
**Post date:** [March 26, 2014, 12:17am UTC](https://forums.unrealengine.com/t/how-do-i-log-a-simple-string/969/2 "2014-03-26T00:17:55Z")

</div>

To make your own log category you can do the following:

In a header:  
DECLARE\_LOG\_CATEGORY\_EXTERN(MyLogCategory, Log, All);

In a cpp:  
DEFINE\_LOG\_CATEGORY(MyLogCategory)

Note: There are other ways to setup log categories (see AssertionMacros.h)

to use:

UE\_LOG(MyLogCategory, Log, TEXT(“This is my message that prints to the log. It works like printf”) );

The second parameter is verbosity and there are many levels of vebosity. The can be found in the ELogVerbosity enum in OutputDevice.h. The “fatal” verbosity level will cause an assertion when used.

UE\_LOG also works like printf. E.G:

UE\_LOG(MyLogCategory, Log, TEXT(“I have %d cats”), 2 );

if you just want something quick and dont want to setup your own category you can use the LogTemp category:

UE\_LOG(LogTemp, Log, … );

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [March 26, 2014, 12:58am UTC](https://forums.unrealengine.com/t/how-do-i-log-a-simple-string/969/3 "2014-03-26T00:58:58Z")

</div>

Adding to Matt’s wonderful answer,

I’ve created a Wiki page for Logs!

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![maikklein](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/maikklein/32/918666_2.png) [@maikklein](https://forums.unrealengine.com/u/maikklein)\
**Post date:** [March 26, 2014, 1:04am UTC](https://forums.unrealengine.com/t/how-do-i-log-a-simple-string/969/4 "2014-03-26T01:04:51Z")

</div>

Thanks, that helped me a lot.

---

<div class="post-metadata">

**Author:** ![gregdumb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gregdumb](https://forums.unrealengine.com/u/gregdumb)\
**Post date:** [March 26, 2014, 3:11am UTC](https://forums.unrealengine.com/t/how-do-i-log-a-simple-string/969/5 "2014-03-26T03:11:47Z")

</div>

You can also use

GEngine-\>AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT(“This is the log!”));

to write some text on the screen, useful if you need to check if your function is being called or not.

---

<div class="post-metadata">

**Author:** ![Kris](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kris/32/758129_2.png) [@Kris](https://forums.unrealengine.com/u/Kris)\
**Post date:** [March 26, 2014, 6:50pm UTC](https://forums.unrealengine.com/t/how-do-i-log-a-simple-string/969/6 "2014-03-26T18:50:58Z")

</div>

If you’re lazy - and who isn’t - you can use macros to make it even easier.  
See [Wiki: Log Macro with Netmode and Colour](https://wiki.unrealengine.com/Log_Macro_with_Netmode_and_Colour).

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8df3d2bc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8df3d2bc](https://forums.unrealengine.com/u/anonymous_user_8df3d2bc)\
**Post date:** [March 27, 2014, 9:01am UTC](https://forums.unrealengine.com/t/how-do-i-log-a-simple-string/969/7 "2014-03-27T09:01:23Z")

</div>

Thanks for writing up the Wiki, Rama!
