Silly logging questions - I shot myself in the foot

So, I’m dumping something to the log and I’ll be dogged if I can figure out where I’m doing it??!?!

Here’s a snippet from the log:

9 Sep 15:01:01 - [warn] [function:Convert Uptime Seconds] end of converting uptime seconds
[ '17 days', ' 22:40:14.700000' ]
9 Sep 15:02:01 - [warn] [function:Convert Uptime Seconds] convertUptimeSecondsToString - start
9 Sep 15:02:01 - [warn] [function:Convert Uptime Seconds] convertUptimeSecondsToString - end
9 Sep 15:02:01 - [warn] [function:Convert Uptime Seconds] end of converting uptime seconds
[ '17 days', ' 22:41:14.730000' ]
9 Sep 15:03:01 - [warn] [function:Convert Uptime Seconds] convertUptimeSecondsToString - start
9 Sep 15:03:01 - [warn] [function:Convert Uptime Seconds] convertUptimeSecondsToString - end
9 Sep 15:03:01 - [warn] [function:Convert Uptime Seconds] end of converting uptime seconds
[ '17 days', ' 22:42:14.770000' ]

It’s the bolded, italicized output I can’t find!?

I recognized the data - it’s the uptime of the router. It’s transmitted in seconds and I have a routine that converts it to days, hours, minutes, etc.

That’s my data!?!? Only for the life of me, I cannot find where it’s being logged! All of my logging (I think) is done with “node.warn()” or “node.error(), node.status()” etc. Hence the log lines start with the date and time. But note the problem line does NOT have the date and time stamp.

Does anyone recognize a possible node-red function I could be calling that would log an entry withOUT the date and time stamp?

This is what I’m using on my Pi4 to dump the logfile: sudo journalctl -f -u nodered -o cat

I’m being a dummy and I’m not sure why! :slight_smile: thanks

How does Node-red obtain the router uptime - what nodes are involved?

Are you sure it's not created by the warn message above it, maybe it's just wrapped to next line, or you have a line break in the message ?

Just comment out that line and run the function to see if the message goes away.

Do you have a debug node attached, if yes, check its settings (where it is logging to).

Subscribes to an MQTT topic.

Ah - that’s a good thought. But I did comment out the line and that one output remains. I’m perplexed. Clearly it’s something I did. I just wish I knew what. :grinning_face:

Will do. I did a “Search” from NR for the word “days” and got hits in what appears to be only code. Var names. I suck at JS, so maybe I (or ChatGPT, that wrote the code) did something.

I’ll keep digging!

FOUND IT! Sheeeeeeeeeeeeeeeeesh…………………….. I knew I was an idiot. :slight_smile:

That data wasn’t router uptime, it was Pi uptime. They’re almost identical since they boot together. I had a “console.log()” in the code. That’s what was writing to the log with no date/time stamp.

Geebus.

It was silly, nothing fatal or even a problem. It was just bugging me.

Thanks all!

1 Like

Can you share the code in this function ?

It could just be a console.log() in a node, anything in the backend can just print to the console.

It looks like it's just printing the content of an array with 2 elements, so tracking it down could be tricky.