How do I add user defined logs in log file

I want to add logs to log file in Node-RED to check whether workflow is working properly.
Can anyone help me out how to add logs.

Thank you!

In a debug node, if you select output to console then it will be sent to the node red log, so will appear in the terminal running node-red. Is that good enough?
Similarly, text output using node.warn() in a function node will appear there.

In a function node, you can use node.log - annoyingly though, it only takes a single parameter and you have to flatten objects.

...or use node-red-contrib-flogger

I want logs to be added in Notepad file.

Eg:. If I am sending email using email node then log should be added to log file that email is sent to respective person.

So what do you need that is not supported by the flogger node?

Flogger node is returning JSON type data. If there is any error occurred we cannot identify that error in log file that is generated using flogger.

Do you mean this statement in the description is not correct?
"You can define different output formats like plain textfile or JSON format "
If so then I suggest you raise an issue against the bug.
What have you got Log Style set to?

I know that we can define different output formats in flogger but the format for that will be fixed. I want user defined format for log file.

Well change the format before writing it to flogger as plain text.

Where is output of node.log printed?

I mean if we are using node.warn output of that statement is printed in Debug window of node-red but where is output of node.log printed?

Have a read of the user guide.

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