# Dynamic, live debug & message tracing

**URL:** <https://discourse.nodered.org/t/dynamic-live-debug-message-tracing/92319>\
**Category:** General\
**Tags:** debug\
**Created:** [11 October 2024 14:44 UTC](https://discourse.nodered.org/t/dynamic-live-debug-message-tracing/92319 "2024-10-11T14:44:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [11 October 2024 14:44 UTC](https://discourse.nodered.org/t/dynamic-live-debug-message-tracing/92319/1 "2024-10-11T14:44:44Z")

</div>

Hi There,

I have heard that one minor bugbear about Node-RED is debugging. Typical scenario is the missing debug node and having to add it, then having to redeploy and then having to restart the flow. And then nothing happens because the problem seems to have "fixed" itself.

Arising out of a desire to have [message tracing](https://discourse.nodered.org/t/message-tracing-for-beginners/92287), I've put together a dynamic debugger - in was not my intention but it just happened.

What this does is allow dynamic toggling of debug messages (plus message tracing). By dynamic I mean no deploy or flow restart necessary. The animation shows how it works:

![msgtracer6](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/4/5452d13598f4f9d7ffbbf818bd67d490f450e405.gif)

Step one is that I turn on message tracing and see _in live_ where messages are flowing. Second step I turn "Msg to Debug" and suddenly **all** messages that are currently flowing around Node-RED are sent to the debug panel. The debug panel works as expected, just as if the debug node had sent the message.

Notice that the deploy button does not change - there is **no need** to redeploy or restart the flow, nor to add debug nodes.

Also the difference here to the debug node (which can also be toggled) is that there is no debug node - this is a catch all, debug all feature. It will also debug _debug_ nodes!

Why? Because quite a few people have issues with debugging Node-RED and getting insides into what Node-RED is actually doing - in live.

Either way, this is all available in the [introspection package version 0.8.5](https://flows.nodered.org/node/@gregoriusrippenstein/node-red-contrib-introspection).

This feature has **no** overhead (neither client nor server) if **not** utilised - the hooks and communication are removed when the message tracing is deactivated - the backend has no extra overhead by installing this node package and not activating the message tracing.

DISCLAIMER:

The Node-RED editor can be **seriously** impeded if there are many messages circulating in Node-RED, use with care else the editor might literally freeze up. This could definitely also happen to the backend since each message is sent over the wire to the client - PLEASE be careful.

If unsure, don't use.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [16 October 2024 15:47 UTC](https://discourse.nodered.org/t/dynamic-live-debug-message-tracing/92319/2 "2024-10-16T15:47:44Z")

</div>

With [0.9.4](https://flows.nodered.org/node/@gregoriusrippenstein/node-red-contrib-introspection) I've made an important change: all nodes and message are **no longer** traced by default. Tracing only works on a selection of nodes.

Also msg tracing and sending messages to debug are two separate operations, neither by default working **all** nodes and flows.

Instead a selection of nodes must be made - upon which to act - **or** if you really want to trace and debug _everything_ there is an extra "All nodes?" checkbox that can be used to confirm that desire.

I think this will prevent accidental damage and frustration.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [20 October 2024 13:13 UTC](https://discourse.nodered.org/t/dynamic-live-debug-message-tracing/92319/3 "2024-10-20T13:13:20Z")

</div>

I put up a short [writeup](https://blog.openmindmap.org/blog/dynamic-debugger-for-node-red) on this feature and that reminded me of an important point:

If you are going to use this, then **turn it off** before exiting the editor else the server will continue to send messages to the client. If this does happen, then reopen the editor and toggle the feature on/off and that will clean up the server, i.e., remove event listening hooks.

---

<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 January 2025 13:13 UTC](https://discourse.nodered.org/t/dynamic-live-debug-message-tracing/92319/4 "2025-01-18T13:13:58Z")

</div>

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