# Node-red-log to file

**URL:** <https://discourse.nodered.org/t/node-red-log-to-file/27683>\
**Category:** General\
**Created:** [2 June 2020 21:12 UTC](https://discourse.nodered.org/t/node-red-log-to-file/27683 "2020-06-02T21:12:49Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![StrongTown](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@StrongTown](https://discourse.nodered.org/u/StrongTown)\
**Post date:** [2 June 2020 21:12 UTC](https://discourse.nodered.org/t/node-red-log-to-file/27683/1 "2020-06-02T21:12:49Z")

</div>

By now my node-red application is fairly complex. I have 19 tabs each with many nodes and all with some form of unique function coding, many that are extensive. While it seems to run as expected for lengthy periods (days, weeks), at some point something, somewhere, gets to a point where it drives NR to become unhinged. The CPU usage goes up from a few % to 80% or more and memory usage maxes out. Eventually the application just stops functioning and sometimes stopping it and getting it restarted is a multi-step, iterative process before success. (Note: Node Red does not necessarily terminate, it most often will lock up, though sometimes it terminates). I'm having a challenge finding the culprit here.

As a side note I do use the exec node a fair amount to launch Cepstrals "Swift" to initiate speech or "omxplayer" to launch an mp3 file.

I access and program the Rpi3 remotely, either via HTTP (editor) or using VNC. When it goes haywire I start to have challenges accessing it by either of these methods (likely due to RAM problem). It is not convenient at all to set up a monitor, keyboard / mouse where the device resides.

What I wish to do (having just set settings.js to `level: "trace"`) is have the console log append a file on the USB drive connected so I can review it whenever the issue reoccurs. So far when I can catch the log before everything gets too wonky the last set of messages have not been helpful to identify what triggered the abnormality (however that was with `level: "info"` ).

Having reviewed the node.js command line options I tried to implement `node --report-on-fatalerror` and `node --report-directory="mydir"` however these both produced the response:

**\> node: --report-on-fatalerror option is valid only when --experimental-report is set**

`node --experimental-report=true` produces this (which I'm not sure how to make use of for my intentions):

**\> Welcome to Node.js v12.16.2.**  
**\> Type ".help" for more information.**  
**\> \>**

Some guidance here is most welcome.

---

_[View the full topic](https://discourse.nodered.org/t/node-red-log-to-file/27683)._
