# Is UE\_LOG thread safe?

**URL:** <https://forums.unrealengine.com/t/is-ue-log-thread-safe/341507>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [December 15, 2015, 9:27am UTC](https://forums.unrealengine.com/t/is-ue-log-thread-safe/341507 "2015-12-15T09:27:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TrevD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TrevD](https://forums.unrealengine.com/u/TrevD)\
**Post date:** [December 15, 2015, 9:27am UTC](https://forums.unrealengine.com/t/is-ue-log-thread-safe/341507/1 "2015-12-15T09:27:31Z")

</div>

I would like to call UE\_LOG from another thread (spawned using C++11 std::thread, not an FRunnableThread).

Is UE\_LOG thread safe?

Also, I read on the wiki that you shouldn’t call some unreal objects from a separate thread:

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

Is it safe to call UE\_LOG?

Thanks

---

<div class="post-metadata">

**Author:** ![getnamo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/getnamo/32/1194624_2.png) [@getnamo](https://forums.unrealengine.com/u/getnamo)\
**Post date:** [December 15, 2015, 2:37pm UTC](https://forums.unrealengine.com/t/is-ue-log-thread-safe/341507/2 "2015-12-15T14:37:17Z")

</div>

+1 for this, curious. I’ve generally found that calling UE\_LOG from different threads gives an expected response (make sure the variables you bind to UE\_LOG are safely accessed though or copied), but it would be good to get some answer on what the best practices are.

---

<div class="post-metadata">

**Author:** ![TrevD](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TrevD](https://forums.unrealengine.com/u/TrevD)\
**Post date:** [December 16, 2015, 2:14pm UTC](https://forums.unrealengine.com/t/is-ue-log-thread-safe/341507/3 "2015-12-16T14:14:42Z")

</div>

Yes, I’m new to unreal and so am very interested in best practices! 🙂 Interestingly, if it _is_ thread safe, then that would also mean it’s probably best to avoid it in performance critical code, since it would likely compete with other threads for a mutex.

---

<div class="post-metadata">

**Author:** ![joeGraf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joeGraf](https://forums.unrealengine.com/u/joeGraf)\
**Post date:** [December 16, 2015, 6:26pm UTC](https://forums.unrealengine.com/t/is-ue-log-thread-safe/341507/4 "2015-12-16T18:26:50Z")

</div>

The answer is “it depends.” Each FOutputDevice can overload CanBeUsedOnAnyThread() to indicate whether it’s threadsafe or not. Typically if it’s expected to be called from a particular thread it will assert with check(AllowedThreadId == GetThreadId());

---

<div class="post-metadata">

**Author:** ![Kyeongho\_Park](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kyeongho\_Park](https://forums.unrealengine.com/u/Kyeongho_Park)\
**Post date:** [August 4, 2020, 1:47am UTC](https://forums.unrealengine.com/t/is-ue-log-thread-safe/341507/5 "2020-08-04T01:47:15Z")

</div>

As of 4.25,  
`CanBeUsedOnAnyThread()` is `true` for these `FOutputDevice`s:

- `SDeviceOutputLog`
- `FWindowsConsoleOutputDevice`
- `FOutputDeviceAnsiError`
- `FOutputDeviceDebug`
- `FOutputDeviceFile`
- `FOutputDeviceMemory`
- `FOutputDeviceStdOutput`

`false` otherwise.
