# Create a simple log console

**URL:** <https://discourse.nodered.org/t/create-a-simple-log-console/24593>\
**Category:** Dashboard\
**Created:** [10 April 2020 14:25 UTC](https://discourse.nodered.org/t/create-a-simple-log-console/24593 "2020-04-10T14:25:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fucio7](https://avatars.discourse-cdn.com/v4/letter/f/aeb1de/32.png) [@Fucio7](https://discourse.nodered.org/u/Fucio7)\
**Post date:** [10 April 2020 14:25 UTC](https://discourse.nodered.org/t/create-a-simple-log-console/24593/1 "2020-04-10T14:25:49Z")

</div>

Hi all,

I'm very new to Node-RED and HTML/JS world.  
I have my flow which does things and I save some of the results in a log file (append mode).  
Now I'd like to show in my dashboard the content of this file every time I write something on it and I'd like to auto scroll the window. This is the code I did so far:

`[{"id":"e7cd380a.a4afd","type":"ui_template","z":"88792789.5de198","group":"e2cad6ee.1a36b8","name":"","order":1,"width":0,"height":0,"format":"<script>\nfunction scrollOnLoad(event) {\n const element = event.target;\n element.scrollIntoView({ behavior: 'smooth', block: 'end', inline: 'nearest'});\n}\n</script>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"global","x":420,"y":1040,"wires":[[]]},{"id":"e206f439.99ec4","type":"ui_template","z":"88792789.5de198","group":"e2cad6ee.1a36b8","name":"Log","order":0,"width":"24","height":"7","format":"<div>\n <p ng-style=\"{'margin-bottom':'1em'}\" onLoad=\"scrollOnLoad(event)\">\n {{msg.payload}}\n </p>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":430,"y":1080,"wires":[[]]},{"id":"6d49146e.705d64","type":"tail","z":"88792789.5de198","name":"","filetype":"text","split":"[\\r]{0,1}\\n","filename":"log.txt","inputs":0,"x":310,"y":1080,"wires":[["e206f439.99ec4"]]},{"id":"e2cad6ee.1a36b8","type":"ui_group","z":"","name":"Logger","tab":"4568271d.82b78","order":1,"disp":false,"width":"24","collapse":false},{"id":"4568271d.82b78","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]`

It shows only the last line of the file, which is good. But would be great to show not only the last line but append to the p tag and have the history of the prints.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 May 2020 14:25 UTC](https://discourse.nodered.org/t/create-a-simple-log-console/24593/2 "2020-05-10T14:25:50Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
