Can"t find the node-red logs

Hi everyone !

Is there some crash dump or log files in node-red?
My node-red keep crashing and the cmd console suddently close so I can't see any error messages is there a way to view the logs?

  • I'm on windows 10

No, not by default on windows.

You can start node-red and pipe the output to a file...

node-red > log.txt

1 Like

Thank you Steve ! you are awesome !

This only occurs if you are starting from a shortcut. Open a command prompt and run manually to see the logs.

Or, as Steve says, output to a file. However, you need to do a little more than Steve;s command because that may not give you error output.

I think you need something like:

node-red >log.txt 2>&1

to get the error output as well.

2 Likes

@TotallyInformation I'm not familiar with that syntax, could you "translate" it to human speak please :smiley:

The first > forwards the regular output (stdout) into a log file, the 2> &1 part will then push stderr, the error output to the same output as the standard output.

Additionally, I use a similar syntax in crontab sometimes. Cron is set up to send emails with all output, both stdout and stderr, of the commands executed through cron. As some of those can’t have the standard output quieted through a parameter, these commands are set up through <command> > /dev/null 2> &1 meaning that only the stderr output will be mailed in case an error would have occurred.

2 Likes

You should note that this is standard across platforms, very similar if not the same for Linux/Mac/etc as well. In fact, I'm not sure whether it is part of the POSIX standards?

It's actually part of wider standards, but the syntax is shell based: stdin, stdout and stderr are considered the standard streams. The file descriptor for standard input (stdin) is defined as 0, for stdout it is 1, and stderr is 2. Redirecting these streams is done through the < and > syntax. In order to redirect the stderr stream, on a Bourne-style shell (so both sh and bash) you can use the file descriptor followed by the redirect syntax, so the regular command > output becomes command 2> output.

Bourne-style specifically defines 2> &1 as syntax to redirect the output of the stderr stream, the one with file descriptor 2, to the same output as file descriptor 1, the stdout stream. So to fix my previous statement, rather than outputting it to the command line it will redirect it to the same file descriptor as that log file that was defined.

See the wikipedia entries on this, they're actually quite good :slight_smile:

1 Like