# Python clear Output Log

**URL:** <https://forums.unrealengine.com/t/python-clear-output-log/155056>\
**Category:** Editor Scripting\
**Tags:** unreal-engine\
**Created:** [December 14, 2020, 8:40pm UTC](https://forums.unrealengine.com/t/python-clear-output-log/155056 "2020-12-14T20:40:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickweeden](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nickweeden](https://forums.unrealengine.com/u/nickweeden)\
**Post date:** [December 14, 2020, 8:40pm UTC](https://forums.unrealengine.com/t/python-clear-output-log/155056/1 "2020-12-14T20:40:05Z")

</div>

Is there a command in Python to clear the Output log. I find it very useful when debugging to be able to work with a clean log and it’s annoying to have to keep clicking in the window to clear it.

---

<div class="post-metadata">

**Author:** ![Hansyuan\_Nb](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/hansyuan_nb/32/561253_2.png) [@Hansyuan\_Nb](https://forums.unrealengine.com/u/Hansyuan_Nb)\
**Post date:** [March 31, 2022, 3:59am UTC](https://forums.unrealengine.com/t/python-clear-output-log/155056/2 "2022-03-31T03:59:45Z")

</div>

Same here. Did you found the answer?

---

<div class="post-metadata">

**Author:** ![chpsemail](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chpsemail/32/496464_2.png) [@chpsemail](https://forums.unrealengine.com/u/chpsemail)\
**Post date:** [April 9, 2022, 9:52am UTC](https://forums.unrealengine.com/t/python-clear-output-log/155056/3 "2022-04-09T09:52:41Z")

</div>

I think there’s no straightforward way to clear the output log with python. But there are also three different ways to finish this task.

1. If you can modify the engine, expose SOutputLog::OnClearLog and call it from a BlueprintCallable function from python. But I don’t recommend it, it’s actually dangerous.

2. Add a plugin of your own, implement a subclass of FOutputDevice, and regist it with GLog-\>AddOutputDevice(this), just like OutputLogModule did. Then expose the clear function to python.

3. If you don’t want to add any CPP code at all, you can use third-party modules such as PyAutoGUI to trig the right click and click Clear Log menu item. This is a bit of a hack, but it only use Python ^\_^. Here is a small gif I did using the [TAPython plug-in](https://www.tacolor.xyz/pages/TAPython.html).

![ClearOutput](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/c/41cb46008076021df9b2a2f613fdf9b0b1964bd3.gif)

In fact, I recommend way 2, which does not affect the Engine and is more robust. If you use way 1 and someone abuses this feature, I think you’ll go crazy when you are fixing bugs and can’t find any log.

---

<div class="post-metadata">

**Author:** ![Andrej730](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/andrej730/32/1194692_2.png) [@Andrej730](https://forums.unrealengine.com/u/Andrej730)\
**Post date:** [June 16, 2023, 11:49am UTC](https://forums.unrealengine.com/t/python-clear-output-log/155056/4 "2023-06-16T11:49:22Z")

</div>

All ways to actually clear the output logs are kind of complicated so I just spam it with some whitespaces at the script start, works for some of the cases.

```auto
for i in range(10):
    print(' ')
print('script is loaded')

```
