Inside the edit flogger node you can choose between different levels : ERROR,WARN,INFO,DEBUG and TRACE.
What are supposed to be these options? I changed between them, but I cannot see any differences.
In the log file the only change is at the beginning of each row where you can see error, warm, etc...but it does not seem to filter anything.
Yes. This is creating the log so is logging things with whatever level you set. Then later you can use whatever viewer you like to filter as you wish.
Probably there is a misunderstanding. No matter which log level I set, the output in the file is the same. It keeps every message...it could be called Pluto instead of error, in the file you will see Pluto plus the message object, but it will not filter the messages with level Pluto. Is it more clear now?
Not really. What are you using to view the file ? The node is just the creator.
I am using visual studio code server.
Please take a look to a picture of the log :
Here I change the log level from info to warn and then to error......there aren't any errors, but it shows the prefix error in front of the message. No matter which log level I chose, in the log file it changes only the text before the message into error or info or whatever else outputting all the messages....so it doesn't act as a filter to the messages...I hope it is more clear now.
Indeed, it is not meant to filter, that is your job (or the viewer application). This node is WRITING the file and is tagging it with those labels for you.
So, in my case is useless....if i have 1000 messages...how to find this one that has generated the error in the flow?
When you send it to the flogger node do you know whether it is the one that has generated the error?
If not, then, forgetting about the flogger node, how can you tell that it has generated an error?
I do not know when the error occurs. It could happen in a moment during all the day.
I know that there are errors, because during these days I started to optimize some flows and i see the error messages in the debug window…I do not know why the error is generated, but i know the node in the flow where it is generated..
Any idea how can i trace it?
What is the error and what node is it generated in?
Error messages in the debug window will be automatically logged in the node-red log, and should be flagged as errors. There is no need to manually log them.
The error message is input error, while the node is a custom function node created by my self.
Show us the function and exactly what the error is. 'Input error' is not helpful.
Edit: Or do you mean it is in a custom node type, rather than in a Function node?
Ok,
I will show the part of the flow where I suppose the error occur.
This is the picture :
This is the code : example - Pastebin.com
The input is coming from the mqtt broker (smart switches with tasmota firmware). The function made by myself "switch case" takes the input and based on several option (switch name, button number, single press, double press, etc.) builds the output for the next nodes.
The error occurs between the output of this node with the next one which takes as input the entity of the selected light or group of lights...so probably it passes a non existing entity or something similar, I do not know, but when the error occurs (because it doesn't happen everything) I want to catch it and analyze the entire msg.
The error message should have the node ID or name above it.
Is that a home assistant node?
I do not know what you mean if it is a home assistant node, honestly speaking…i can tell you that node red is started under home assistant…
edit : I was "lucky" and I manage to catch one time the error a couple of minutes ago...this is what I can see....
Hi all, moved this to a new topic as it is really a new issue that needs help.
It's not that difficult:
According to your switch statement, something went wrong
is being issued when msg.payload
has neither .Button1
, .Button2
, .Button3
, .Button4
property defined.
In that case - next to emitting the warning - you take default values...
... to build the msg.paylod
:
I'm pretty sure the next node doesn't like to be feeded with <string>"default"
.
Thus the error occurs not where you guess it does.
It's triggered by the MQTT node sending sth you didn't expect & that your switch function handles inappropriate. That's why I told you (already twice) to intensively wire Debug
nodes to the output terminals - as to be able to examine the msg
objects that are being passed. Yet there's still not a single Debug
node visible at your shots...
ok,
probably you are right that the problem is coming from the Mqtt node which is sending something that I didn't expect
I have also explained to you that while I was developing the flow, I have already used the debug nodes many time....afterwards I started to optimize the code and to add some "upgrades".....
of course it could happen that some "problems" could arise in later moment....now I know the problem from where it could come, but I do not know when it will occur again....that's the main problem....to understand the problem I need to understand when the error occur, what kind of message comes from the mqtt broker, so I could manage it in my fuction.
The best thing in my opinion, if it exists, to save in a log file all the errors with their msg objects, so I can check them at time when it would be suitable for me and not staying in front of the pc hoping that it will happen sometimes. Something like the frogger node but with in addition the possibility to filter the type of messages to keep (in the option of the frogger you can do something similar, but it doesn't work in the way I was thinking to work).
If the error "input error" is shown in the debug windows, probably there could exist something that manage these error on a file...this is what I suppose...but I am not an expert here...so please let me know.
Perhaps you don't need anything (additionally) to track the error:
According to this chapter in the documentation node.warn
& node.error
messages are sent either to console or system log. The Debug
node can emit to the system console as well:
As often as possible RTFM!
Sorry, but just passing by.
Wouldn't the catch
node be more suited to what you want to do?
That catches errors and you can then see the error message.
Stick a debug
node on the output and display the entire message.
I could go on but just to make sure that this may help you for now.