# Logging values gets me this error

**URL:** <https://forums.unrealengine.com/t/logging-values-gets-me-this-error/428551>\
**Category:** C++\
**Tags:** logging, unreal-engine, UE4, CPP, question\
**Created:** [July 2, 2018, 5:03pm UTC](https://forums.unrealengine.com/t/logging-values-gets-me-this-error/428551 "2018-07-02T17:03:21Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Zilphy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zilphy](https://forums.unrealengine.com/u/Zilphy)\
**Post date:** [July 2, 2018, 5:29pm UTC](https://forums.unrealengine.com/t/logging-values-gets-me-this-error/428551/3 "2018-07-02T17:29:57Z")

</div>

You’re trying to print an int with string formatting it seems.

Try this instead:

```
         if (GEngine) {
             GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("Number in the world: %d"), iNumberOfBasicUnits);
         }

```

However I’d recommend using UE\_LOG instead, but it won’t print to screen, it’ll print into your output log, like so:

```
         if (GEngine) {
            UE_LOG(LogTemp, Warning, TEXT("Number in the world: %d"), iNumberOfBasicUnits);
         }

```

Reference this documentation:

> **[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...

---

_[View the full topic](https://forums.unrealengine.com/t/logging-values-gets-me-this-error/428551)._
