# How print and how open the console?

**URL:** <https://forums.unrealengine.com/t/how-print-and-how-open-the-console/413494>\
**Category:** Platform & Builds\
**Tags:** how-to, Console, unreal-engine, question\
**Created:** [January 1, 2018, 5:02am UTC](https://forums.unrealengine.com/t/how-print-and-how-open-the-console/413494 "2018-01-01T05:02:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_4b5aaaa9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4b5aaaa9](https://forums.unrealengine.com/u/anonymous_user_4b5aaaa9)\
**Post date:** [January 1, 2018, 5:02am UTC](https://forums.unrealengine.com/t/how-print-and-how-open-the-console/413494/1 "2018-01-01T05:02:48Z")

</div>

I want to say “hello world” in the console and also how open the console in the game

---

<div class="post-metadata">

**Author:** ![Vizgin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vizgin](https://forums.unrealengine.com/u/Vizgin)\
**Post date:** [January 1, 2018, 5:28am UTC](https://forums.unrealengine.com/t/how-print-and-how-open-the-console/413494/2 "2018-01-01T05:28:58Z")

</div>

Hi,

You can access the console from inside the UE4 editor, _Window \> Developer Tools \> Output Log_. It appears as a separate tab next to the Content Browser.

To print a message from C++ code you need this:

```
UE_LOG(LogTemp, Warning, TEXT("Hello World!"));
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3b7561f0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3b7561f0](https://forums.unrealengine.com/u/anonymous_user_3b7561f0)\
**Post date:** [January 1, 2018, 5:56am UTC](https://forums.unrealengine.com/t/how-print-and-how-open-the-console/413494/3 "2018-01-01T05:56:30Z")

</div>

For some reason, using a semi-colon (the ; symbol) after a macro in UE4, like with UE\_LOG, makes the project not compile. IntelliSense also says that it’s wrong for some reason. Yet, when I do tutorials and whatnot I always see people using the semi-colon at the end and I don’t understand why it works for them but not for me.

---

<div class="post-metadata">

**Author:** ![Vizgin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Vizgin](https://forums.unrealengine.com/u/Vizgin)\
**Post date:** [January 1, 2018, 6:11am UTC](https://forums.unrealengine.com/t/how-print-and-how-open-the-console/413494/4 "2018-01-01T06:11:47Z")

</div>

That’s strange! I’ve never encountered such issue!

In general, `UE_LOG` does not require a semicolon at the end but the reason everyone uses it is to be consistent with c++ which requires a semicolon at the end of each statement.

Not sure if it helps but try including `"UObject/ObjectMacros.h"`. Maybe it fixes your intellisense issues and hence the compiling errors.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4b5aaaa9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4b5aaaa9](https://forums.unrealengine.com/u/anonymous_user_4b5aaaa9)\
**Post date:** [January 1, 2018, 7:36pm UTC](https://forums.unrealengine.com/t/how-print-and-how-open-the-console/413494/5 "2018-01-01T19:36:15Z")

</div>

I new in the UE4 developing, can you give me the exact steps? one by one

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_fa8b2652](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_fa8b2652](https://forums.unrealengine.com/u/anonymous_user_fa8b2652)\
**Post date:** [March 29, 2021, 5:18pm UTC](https://forums.unrealengine.com/t/how-print-and-how-open-the-console/413494/6 "2021-03-29T17:18:08Z")

</div>

You generally have to enclose UE\_LOG in brackets even if it’s a single line. It’s a macro that expands to some weird stuff.  
{  
UE\_LOG(…)  
}

---

<div class="post-metadata">

**Author:** ![tmek](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tmek](https://forums.unrealengine.com/u/tmek)\
**Post date:** [October 31, 2023, 8:17pm UTC](https://forums.unrealengine.com/t/how-print-and-how-open-the-console/413494/7 "2023-10-31T20:17:26Z")

</div>

This is an old thread, but it didn’t seem like what OP was looking for had been answered.

Assuming OP wanted to know how to print to the game’s viewport console and not the editor’s “Output Log” console you need to get the `UConsole` object from `UGameViewportClient::ViewportConsole`

```auto
GetWorld()->GetGameViewport()->ViewportConsole->OutputText(TEXT("Hello From the Viewport Console!"));

```
