# Add log to Dashboard without an array

**URL:** <https://discourse.nodered.org/t/add-log-to-dashboard-without-an-array/69210>\
**Category:** Dashboard\
**Created:** [18 October 2022 17:35 UTC](https://discourse.nodered.org/t/add-log-to-dashboard-without-an-array/69210 "2022-10-18T17:35:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thalesmaoa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thalesmaoa/32/17067_2.png) [@thalesmaoa](https://discourse.nodered.org/u/thalesmaoa)\
**Post date:** [18 October 2022 17:35 UTC](https://discourse.nodered.org/t/add-log-to-dashboard-without-an-array/69210/1 "2022-10-18T17:35:31Z")

</div>

Hello, I there are many contributors that already have discussed this problem.

> **[Display Node-Red Log Output using Dashboard 2 (flow) - Node-RED](https://flows.nodered.org/flow/6dc1a137075ad93cd7c00224681afeda)**

> [@Node-red-log to dashboard](https://discourse.nodered.org/t/node-red-log-to-dashboard/37034/4):
>
> Sorry, it's wrong link Correct one is here. [Node-red-log Data Export](https://discourse.nodered.org/t/node-red-log-data-export/16168/13) It's used button to activate the node-red-log. Actually, I want to log the activity of dashboard such as button, slider, all user input. Currently, I use "link in" and "link out" nodes to trigger instead of button. [nr log] Thanks, Aung

> [@Help with displaying text log](https://discourse.nodered.org/t/help-with-displaying-text-log/37333/5):
>
> Thanks for all the reply's! Thought id share the flow for others benefit Result [image]

> [@I need to display a program event log in dashboard](https://discourse.nodered.org/t/i-need-to-display-a-program-event-log-in-dashboard/1695/16):
>
> dceejay, First, Thank you for your input. I'm attempting this project through Node-Red and I seem to be coming from the other side of the fence... Windows. I am writing Warning and Error events to a Status Log File. I need to record the events anyway. The file reading was pursued to manage the lines. I was looking for any kind of NODE, or grouping of Nodes to do this kind of thing. I found something, it used the console output. I hadn't understood how to save it to file, or if was alrea…

However, I have a question about the presented approach.  
In general, variables are stored in context or flow. An array is built and than displayed using Angular.js.

Is there a way to dynamic add msg.payload without store it in the context.

For instance, using jQuery, is it possible to append:

```auto
$( "body" ).append('<div>log line</div>');

```

Can I do the same using Angular or it is only possible with jQuery?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 October 2022 20:32 UTC](https://discourse.nodered.org/t/add-log-to-dashboard-without-an-array/69210/2 "2022-10-18T20:32:22Z")

</div>

> [@thalesmaoa](#):
>
> Is there a way to dynamic add msg.payload without store it in the context.

Yes. In fact, there might even be one of my old flows in the flows library that works like that. I remember a long time ago building a simple log output to a web page. Don't remember all the details though and it is possible I didn't use Dashboard. However, the principle would be the same.

The concept is simple, you append to the DOM as you indicated. In fact, you can use Angular to assist by using a ui\_template node, creating a loop in the code that is driven by a local variable. Then you send updates to that variable. Personally I find Angular a pain though which is one of the reasons why I don't do anything complex in Dashboard.

Of course, everything will be reset if someone reloads the Dashboard tab unless you also create a cache in node-red.

---

<div class="post-metadata">

**Author:** ![thalesmaoa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thalesmaoa/32/17067_2.png) [@thalesmaoa](https://discourse.nodered.org/u/thalesmaoa)\
**Post date:** [18 October 2022 22:56 UTC](https://discourse.nodered.org/t/add-log-to-dashboard-without-an-array/69210/3 "2022-10-18T22:56:50Z")

</div>

Thanks @TotallyInformation. That is exactly what I'm looking for. Can you give me an example on how to perform it? Your idea is indeed jQuery? I can also limit the log number by counting elements.

In theory, I know how to do it. Unfortunately, I'm not a javascript expert. I always spend a lot of time for simple tasks.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [19 October 2022 00:07 UTC](https://discourse.nodered.org/t/add-log-to-dashboard-without-an-array/69210/4 "2022-10-19T00:07:30Z")

</div>

Have a look at:

- [Better debugging (flow) - Node-RED (nodered.org)](https://flows.nodered.org/flow/b0fcb7b72fc05a30e55b)
- [Display Node-Red Log Output using Dashboard 2 (flow) - Node-RED (nodered.org)](https://flows.nodered.org/flow/6dc1a137075ad93cd7c00224681afeda)
- [Debug messages using uibuilder (flow) - Node-RED (nodered.org)](https://flows.nodered.org/flow/2cefa818970963b7fb79a48929538e53)

and see if any of them come anywhere near what you are thinking of. They are a bit old but might still have some useful ideas.

---

<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:** [18 November 2022 00:08 UTC](https://discourse.nodered.org/t/add-log-to-dashboard-without-an-array/69210/5 "2022-11-18T00:08:04Z")

</div>

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