Node-RED will create different logs as processes trigger logging messages. Those messages are categorized in levels. Depending on the cause of the message, the following types of logs can occur:
error: fatal for a particular request
warn: problems which are not fatal
info: information about the general running of the application
debug: information that is more verbose than info
trace: very detailed logging
Debug and Trace messages will only appear if the Node-RED settings in the Flow App are set to display those messages.
While creating your project, you will need to analyze error messages if something you build doesn't work. The messages will always be stored in the Logs section. Some will be displayed in the Debug messages section of the editor’s sidebar.
Level of logging
To test the values and triggering of nodes, you can add Debug nodes to the position you want to test to display the incoming message. If you want to display specific messages inside a function node, you can use the functions displayed in the table to generate a log message. You can add strings or variables to display.
To handle unexpected errors in Node-RED, the subflow below (catch-error.json) can be used to be triggered whenever a node reports an error. It will output a general error message with details to pinpoint the node responsible for the error. One of those subflows can be added to a Node-RED flow. It is not necessary to add them to other subflows. If an error occurs in a subflow, the event gets passed on to the flow this node was placed in.